Showing results for 
Search instead for 
Did you mean: 

ReUse Function of VBS-macro in another VBS-Macro

Occasional Contributor

ReUse Function of VBS-macro in another VBS-Macro

I've written an VBS-macro in MEGA/HOPEX. This macro performs some actions on several class within a Package.

Now I've been asked to create/add a similar project that does the same but only from a single class. I would like to reuse some functions that I use in the first script without just taking a copy of the original macro but I would like to create a macro with some shared functions. I would like to call these shared functions then in the original script and in the newly created script.


Can someone tell me how to call these shared functions in a macro?


I've tried the following but without success:

Dim SharedFunctionsMacro
SharedFunctionsMacro = myRoot.GetObjectFromID("68146F565D9D3D76")


If SharedFunctionsMacro.Check_Association_composed(Report, aClass, True) = True Then
End If

Where Check_Association_composed is a function in the shared script:

Function Check_Association_composed(Report, aClass, bClassDiagramIteration)' As Boolean
End Function