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 (Sub
s) and user-defined functions (Function
s). 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 Sub
After this code runs, Excel displays the options on the Insert Function dialog as shown in Figure 7-3.
Figure 7-3. How Excel ...
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.