Document.RunAutoMacro Method (2007 System)
Runs an auto macro that is stored in the document.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public Sub RunAutoMacro ( _
Which As WdAutoMacros _
)
'Usage
Dim instance As Document
Dim Which As WdAutoMacros
instance.RunAutoMacro(Which)
public void RunAutoMacro(
WdAutoMacros Which
)
public:
void RunAutoMacro(
WdAutoMacros Which
)
public function RunAutoMacro(
Which : WdAutoMacros
)
Parameters
Which
Type: WdAutoMacrosOne of the WdAutoMacros values.
Remarks
If the specified auto macro does not exist, nothing happens.
Examples
The following code example uses the RunAutoMacro method to run the AutoOpen auto macro. This example assumes that the AutoOpen macro has been added to the document.
This example is for a document-level customization.
Private Sub DocumentRunAutoMacro()
Me.RunAutoMacro(Word.WdAutoMacros.wdAutoOpen)
End Sub
private void DocumentRunAutoMacro()
{
this.RunAutoMacro(Word.WdAutoMacros.wdAutoOpen);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.