ModuleLoadThis Function

Syntax
ModuleLoadThis(ModuleCode$, CreateNew)
Group
Flow Control
Description
Load ModuleCode as a module. Does not execute the module. Macro's can not be loaded. Returns an object if successful, otherwise Nothing is returned.
Parameters Description
ModuleCode$ Load the module code in this string value.
CreateNew Return a new instance if True. Otherwise return the default instance. A class module does not have a default instance. A code module can not have a new instance.
See Also
MacroCheck, MacroCheckThis, MacroRun, MacroRunThis, ModuleLoad

Sub Main
    Dim Obj As Object
    Set Obj = ModuleLoadThis("Sub DoIt" & vbCrLf & "End Sub", False)
    Obj.DoIt ' call Demo's DoIt method
End Sub