Showing results for 
Show  only  | 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


1 Reply

Re: ReUse Function of VBS-macro in another VBS-Macro

There are many example in standard.


Have you common script in a Macro.


Then in another macro call the first macro :  oMegaRoot.CurrentEnvironment.GetMacro(" you macro")