DocumentBase.RunAutoMacro Method

Runs an auto macro that is stored in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub RunAutoMacro ( _
    which As WdAutoMacros _
)
public void RunAutoMacro(
    WdAutoMacros which
)

Parameters

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

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

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace