編輯

共用方式為


_Application.Run Method

Definition

Runs a Visual Basic macro.

public 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);
abstract member Run : string * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj -> obj
Public Function Run (MacroName As String, Optional ByRef varg1 As Object, Optional ByRef varg2 As Object, Optional ByRef varg3 As Object, Optional ByRef varg4 As Object, Optional ByRef varg5 As Object, Optional ByRef varg6 As Object, Optional ByRef varg7 As Object, Optional ByRef varg8 As Object, Optional ByRef varg9 As Object, Optional ByRef varg10 As Object, Optional ByRef varg11 As Object, Optional ByRef varg12 As Object, Optional ByRef varg13 As Object, Optional ByRef varg14 As Object, Optional ByRef varg15 As Object, Optional ByRef varg16 As Object, Optional ByRef varg17 As Object, Optional ByRef varg18 As Object, Optional ByRef varg19 As Object, Optional ByRef varg20 As Object, Optional ByRef varg21 As Object, Optional ByRef varg22 As Object, Optional ByRef varg23 As Object, Optional ByRef varg24 As Object, Optional ByRef varg25 As Object, Optional ByRef varg26 As Object, Optional ByRef varg27 As Object, Optional ByRef varg28 As Object, Optional ByRef varg29 As Object, Optional ByRef varg30 As Object) As Object

Parameters

MacroName
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
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg2
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg3
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg4
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg5
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg6
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg7
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg8
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg9
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg10
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg11
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg12
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg13
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg14
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg15
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg16
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg17
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg18
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg19
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg20
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg21
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg22
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg23
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg24
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg25
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg26
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg27
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg28
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg29
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

varg30
Object

Optional Object. Macro parameter values. You can pass up to 30 parameter values to the specified macro.

Returns

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.

Applies to