Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Macro Object / RunMacro Method
A MacroEnumerationOption Enumeration value that specifies the location of the macro. MacroEnumerationOption_Document specifies a macro in the session document's VBA project. MacroEnumerationOption_Common specifies a macro in the Common VBA project.
The name of the macro to run.
Parameter to pass to the macro.
Example
In This Topic
    RunMacro Method (Macro)
    In This Topic
    Runs a macro that takes a single parameter.
    Syntax
    expression.RunMacro( _
       ByVal macroSource As MacroEnumerationOption, _
       ByVal macroName As String, _
       ByVal macroParameter As String _
    ) 
    where expression is a variable that represents a Macro Object

    Parameters

    macroSource
    A MacroEnumerationOption Enumeration value that specifies the location of the macro. MacroEnumerationOption_Document specifies a macro in the session document's VBA project. MacroEnumerationOption_Common specifies a macro in the Common VBA project.
    macroName
    The name of the macro to run.
    macroParameter
    Parameter to pass to the macro.
    Remarks

    For more about using the RunMacro method, see:

    Controlling Macro Execution

    Example
    This sample runs a macro with a parameter and displays the parameter. To run this sample, paste the code into a module named "Module1" and then run the RunMacroExample macro.
    Sub RunMacroExample()
     
        Dim param As Variant
        param = "A simple Macro with a parameter"
        
        ThisIbmTerminal.Macro.RunMacro MacroEnumerationOption_Document, "Module1.SimpleMacro", param
     
     
    End Sub
     
    Sub SimpleMacro(param)
     
        Dim text As String
        text = param
        MsgBox text
        
    End Sub
    See Also