RunAutoMacro Method

Applies To

Document object.

Description

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.

Syntax

expression.RunAutoMacro(Which)

expression Required. An expression that returns a Document object.

Which Required Long. The auto macro to run. Can be one of the following WdAutoMacros constants: wdAutoClose, wdAutoExec, wdAutoExit, wdAutoNew, or wdAutoOpen.

See Also

Run method.

Example

This example runs the AutoOpen macro in the active document.

ActiveDocument.RunAutoMacro Which:=wdAutoOpen