GetModuleInstance Function

Syntax
GetModuleInstance([ProjectName$], ModuleName$, CreateNew)
Group
Object
Description
Get an existing or new object of type ProjectName$.ModuleName$. Use Set to assign the returned object to an object variable.
Sandbox
Sandbox mode may block this function.
Parameters Description
ProjectName$ This is the project where the module is defined. The project must already be loaded. The name of the current project and any referenced or referencing project can be used. A module defined outside of a project has a null-project name ("").
ModuleName$ This is the module/class. The module/class must already be loaded.
CreateNew Use True to create a new class (or object module) instance. Use False to get a module's (object module's default) instance.

Sub Main
    Dim Instance As Object
    Set Instance = GetModuleInstance("Project1", "Module1")
    Instance.DoIt ' show the MsgBox
    CallByName Instance, vbMethod, "DoIt" ' show the MsgBox
End Sub
 
Sub DoIt
    MsgBox "DoIt"
End Sub