ModuleLoad Function

Syntax

ModuleLoad(ModuleName$, CreateNew)

Group

Flow Control

Description

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

Sandbox

Sandbox mode can block this function.

Parameters

Parameters Description
ModuleName$ Loads the module named by 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 = ModuleLoad("Demo")
    Obj.DoIt ' call Demo's DoIt method
End Sub

See also

MacroCheck, MacroCheckThis, MacroRun, MacroRunThis, ModuleLoadThis