MacroOptions Method

Microsoft Excel Visual Basic

MacroOptions Method

       

Corresponds to options in the Macro Options dialog box.

expression.MacroOptions(Macro, Description, HasMenu, MenuText, HasShortcutKey, ShortcutKey, Category, StatusBar, HelpContextID, HelpFile)

expression   Required. An expression that returns an Application object.

Macro   Optional Variant. The macro name.

Description   Optional Variant. The macro description.

HasMenu   Optional Variant. This argument is ignored.

MenuText   Optional Variant. This argument is ignored.

HasShortcutKey   Optional Variant. True to assign a shortcut key to the macro (ShortcutKey must also be specified). If this argument is False, no shortcut key is assigned to the macro. If the macro already has a shortcut key, setting this argument to False removes the shortcut key. The default value is False.

ShortcutKey   Optional Variant. Required if HasShortcutKey is True; ignored otherwise. The shortcut key.

Category   Optional Variant. An integer that specifies the macro function category (Financial, Date & Time, or User Defined, for example).

StatusBar   Optional Variant. The status bar text for the macro.

HelpContextId   Optional Variant. An integer that specifies the context ID for the Help topic assigned to the macro.

HelpFile   Optional Variant. The name of the Help file that contains the Help topic defined by HelpContextId.

Example

This example adds a shortcut key for the DoRand macro.

Application.MacroOptions Macro:="DoRand", _
    HasShortcutKey:=True, ShortcutKey:="Z"