Name
Application.MacroOptions([Macro], [Description], [HasMenu], [MenuText], [HasShortcutKey], [ShortcutKey], [Category], [StatusBar], [HelpContextId], [HelpFile])
Synopsis
Sets the description and help files displayed for a macro or user-defined function.
|
Argument |
Setting |
|---|---|
|
|
The name of the macro to set. |
|
|
A description that appears in the Macro or Formula dialog box. |
|
|
Ignored. |
|
|
Ignored. |
|
|
True assigns a shortcut key to the macro. |
|
|
The shortcut key to assign. |
|
|
The name of a category for the user-defined function. Default is User Defined. |
|
|
Ignored. |
|
|
The context ID for the help topic within the compiled help file. Ignored for other help file types. |
|
|
The name of the help file to display for user-defined functions. |
The usable arguments are different for macros (Subs) and user-defined functions (Functions). The Macro dialog box doesn’t use Category, HelpContextId, or HelpFile arguments. The Insert Function dialog box doesn’t use HasShortcutKey or ShortcutKey arguments.
The following code sets the options for the ShowXlOnTop user-defined function:
Sub TestMacroOptions( )
Application.MacroOptions "ShowXlOnTop", _
"Set Excel as the top-most window.", , , , , _
"Windows", "Excel On Top", , _
"http:\\excelworkshop.com\Help\ch07.htm"
End SubAfter this code runs, Excel displays the options on the Insert Function dialog as shown in Figure 7-3.
Figure 7-3. How Excel ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access