Compartilhar via


DocumentBase.RunAutoMacro(WdAutoMacros) Method

Definition

Runs an auto macro that is stored in the document.

public:
 void RunAutoMacro(Microsoft::Office::Interop::Word::WdAutoMacros which);
public void RunAutoMacro (Microsoft.Office.Interop.Word.WdAutoMacros which);
member this.RunAutoMacro : Microsoft.Office.Interop.Word.WdAutoMacros -> unit
Public Sub RunAutoMacro (which As WdAutoMacros)

Parameters

which
WdAutoMacros

One of the WdAutoMacros values.

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. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentRunAutoMacro()
{
    this.RunAutoMacro(Word.WdAutoMacros.wdAutoOpen);
}
Private Sub DocumentRunAutoMacro()
    Me.RunAutoMacro(Word.WdAutoMacros.wdAutoOpen)
End Sub

Remarks

If the specified auto macro does not exist, nothing happens.

Applies to