Syntax
ToolsMacro .Name = text [, .Run] [, .Edit] [, .Show = number] [, .Delete] [, .Rename] [, .Description = text] [, .NewName = text] [, .SetDesc]
Remarks
Runs or records a macro, sets the description of a macro, renames a macro, or opens a new or existing macro in a macro-editing window. The arguments for the ToolsMacro statement correspond to the options in the Macro dialog box (Tools menu). Note that the .Rename and .NewName arguments are included for compatibility with previous versions of Word.
Argument | Explanation | |
.Name | The name of the macro. | |
.Run | Runs the macro. | |
.Edit | Opens a macro-editing window containing the macro specified by .Name. | |
.Show | Specifies the context: 0 (zero) All available macros; includes macros in loaded global templates 1 Macros in the Normal template 2 Built-in commands 3 If the active document is not based on the Normal template, macros in the active template; otherwise, macros in the first loaded global template (global templates are listed in alphabetic order) > 3 Macros in the remaining loaded global templates (in alphabetic order) Omitted Word looks for the macro in whatever context was last selected in the Macro dialog box. To ensure that the correct macro runs, especially if a macro naming conflict between templates is possible, you should specify a value for .Show. | |
.Delete | Deletes the specified macro. | |
.Rename | Renames the specified macro. | |
.Description | Specifies a new description for the macro; used with .SetDesc. If the macro is assigned to a menu or toolbar and is selected or pointed to, the description is displayed in the status bar. | |
.NewName | A new name for the macro; used with .Rename. | |
.SetDesc | Sets a new description for the macro. |
Example
This example opens a macro-editing window for the macro Test stored in the Normal template:
ToolsMacro .Name = "Test", .Show = 1, .Edit
See Also
CountMacros(), IsMacro(), KeyMacro$(), MacroDesc$(), MacroFileName$(), MacroNameFromWindow$(), MenuItemMacro$(), Organizer, PauseRecorder