_Application.Run Method
Runs a Visual Basic macro.
Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)
Syntax
'Declaration
Function Run ( _
MacroName As String, _
ByRef varg1 As Object, _
ByRef varg2 As Object, _
ByRef varg3 As Object, _
ByRef varg4 As Object, _
ByRef varg5 As Object, _
ByRef varg6 As Object, _
ByRef varg7 As Object, _
ByRef varg8 As Object, _
ByRef varg9 As Object, _
ByRef varg10 As Object, _
ByRef varg11 As Object, _
ByRef varg12 As Object, _
ByRef varg13 As Object, _
ByRef varg14 As Object, _
ByRef varg15 As Object, _
ByRef varg16 As Object, _
ByRef varg17 As Object, _
ByRef varg18 As Object, _
ByRef varg19 As Object, _
ByRef varg20 As Object, _
ByRef varg21 As Object, _
ByRef varg22 As Object, _
ByRef varg23 As Object, _
ByRef varg24 As Object, _
ByRef varg25 As Object, _
ByRef varg26 As Object, _
ByRef varg27 As Object, _
ByRef varg28 As Object, _
ByRef varg29 As Object, _
ByRef varg30 As Object _
) As Object
'Usage
Dim instance As _Application
Dim MacroName As String
Dim varg1 As Object
Dim varg2 As Object
Dim varg3 As Object
Dim varg4 As Object
Dim varg5 As Object
Dim varg6 As Object
Dim varg7 As Object
Dim varg8 As Object
Dim varg9 As Object
Dim varg10 As Object
Dim varg11 As Object
Dim varg12 As Object
Dim varg13 As Object
Dim varg14 As Object
Dim varg15 As Object
Dim varg16 As Object
Dim varg17 As Object
Dim varg18 As Object
Dim varg19 As Object
Dim varg20 As Object
Dim varg21 As Object
Dim varg22 As Object
Dim varg23 As Object
Dim varg24 As Object
Dim varg25 As Object
Dim varg26 As Object
Dim varg27 As Object
Dim varg28 As Object
Dim varg29 As Object
Dim varg30 As Object
Dim returnValue As Object
returnValue = instance.Run(MacroName, _
varg1, varg2, varg3, varg4, varg5, _
varg6, varg7, varg8, varg9, varg10, _
varg11, varg12, varg13, varg14, varg15, _
varg16, varg17, varg18, varg19, varg20, _
varg21, varg22, varg23, varg24, varg25, _
varg26, varg27, varg28, varg29, varg30)
Object Run(
string MacroName,
ref Object varg1,
ref Object varg2,
ref Object varg3,
ref Object varg4,
ref Object varg5,
ref Object varg6,
ref Object varg7,
ref Object varg8,
ref Object varg9,
ref Object varg10,
ref Object varg11,
ref Object varg12,
ref Object varg13,
ref Object varg14,
ref Object varg15,
ref Object varg16,
ref Object varg17,
ref Object varg18,
ref Object varg19,
ref Object varg20,
ref Object varg21,
ref Object varg22,
ref Object varg23,
ref Object varg24,
ref Object varg25,
ref Object varg26,
ref Object varg27,
ref Object varg28,
ref Object varg29,
ref Object varg30
)
Parameters
- MacroName
Type: System.String
Required String. The name of the macro. Can be any combination of template, module, and macro name.
If you specify the document name, your code can only run macros in documents related to the current context— not just any macro in any document.
- varg1
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg2
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg3
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg4
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg5
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg6
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg7
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg8
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg9
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg10
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg11
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg12
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg13
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg14
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg15
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg16
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg17
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg18
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg19
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg20
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg21
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg22
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg23
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg24
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg25
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg26
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg27
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg28
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg29
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
- varg30
Type: System.Object%
Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.
Return Value
Type: System.Object
Remarks
Although you can call a macro directly (without using the Run method), this method is useful when the macro name is stored in a variable.