Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Macro Object / RunMacro3 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.
An array of parameters to pass to the macro.
Example
In This Topic
    RunMacro3 Method (Macro)
    In This Topic
    Runs a macro that takes an array of parameters.
    Syntax
    expression.RunMacro3( _
       ByVal macroSource As MacroEnumerationOption, _
       ByVal macroName As String, _
       ByRef macroParameters() As Object _
    ) 
    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.
    macroParameters
    An array of parameters to pass to the macro.
    Example
    The following example demonstrates calling macros that take various parameters. The example also demonstrates a scenario of passing in an invalid parameter type.
    ' Following example provides details on how to use RunMacro3 method
    Sub RunMacro3Example()
        
        Dim params() As Variant
     
        params = Array(123, "param 2 data")
        ThisIbmTerminal.Macro.RunMacro3 MacroEnumerationOption_Document, "Module1.MacroWithTwoParam", params
     
        params = Array("param 1 data", 222, "param 3 data")
        ThisIbmTerminal.Macro.RunMacro3 MacroEnumerationOption_Document, "Module1.MacroWithThreeParam", params
     
        ' Example of calling macro with invalid parameter type. Invalid type passed in to parameter 2
        params = Array("param 1 data", "param 2 data", "param 3 data")
        ThisIbmTerminal.Macro.RunMacro3 MacroEnumerationOption_Document, "Module1.MacroWithThreeParam", params
     
    End Sub
     
    Sub MacroWithTwoParam(param1 As Long, param2 As String)
        MsgBox ("MacroWithTwoParam called with two parameters: param1='" & param1 & "' param2 = '" & param2 & "'")
    End Sub
     
    Sub MacroWithThreeParam(param1 As String, param2 As Long, param3 As String)
        MsgBox ("MacroWithThreeParam called with three parameter: param1='" & param1 & "' param2 = '" & param2 & "' param3 = '" & param3 & "'")
    End Sub
    See Also