ModuleLoadThis Function

Syntax

ModuleLoadThis(ModuleCode$, CreateNew)

Group

Flow Control

Description

Load sModuleCode as a module. Does not execute the module. Macros cannot be loaded. Returns an object if successful, otherwise nothing is returned.

Parameters

Parameters Description
ModuleCode$ Loads the module code in this string value.
CreateNew Returns a new instance if True. Otherwise it returns the default instance. A class module does not have a default instance. A code module cannot have a new instance.

Example


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

See also

MacroCheck, MacroCheckThis, MacroRun, MacroRunThis, ModuleLoad