RunAutoMacro Method

Runs an auto macro that's stored in the specified document. If the specified auto macro doesn't exist, nothing happens.

Note  Use the Run method to run any macro.

expression.RunAutoMacro(Which)

expression Required. An expression that returns one of the objects in the Applies To list.

WdAutoMacros

WdAutoMacros can be one of these WdAutoMacros constants.
wdAutoExec
wdAutoNew
wdAutoClose
wdAutoExit
wdAutoOpen
wdAutoSync

Example

This example runs the AutoOpen macro in the active document.

ActiveDocument.RunAutoMacro Which:=wdAutoOpen

Applies to | Document Object

See Also | Run Method