WD: ToolsMacro .Run Does Not Follow Context HierarchyLast reviewed: February 2, 1998Article ID: Q81027 |
The information in this article applies to:
SUMMARYIn the Microsoft Word for Windows 2.x WordBasic macro language, the ToolsMacro .Run command is not designed to follow the context hierarchy prescribed for running Word for Windows macros. This is because the command corresponds to the Macro dialog box where the context is selected with an option button in the Show box. In Word versions 6.x, 7.x, the ToolsMacro .Run command has an argument that is designed to follow the context hierarchy.
MORE INFORMATIONWhen you run a Word for Windows macro from the command line (ie. if you start Word by typing "WIN WINWORD /mMyMacro" at the MS-DOS prompt), Word looks for the macro first in the document template, then in Normal.dot, and finally in the built-in commands. This hierarchy holds even if the macro has the same name as a built-in command (such as FilePrint). When you run a Word for Windows macro that has the same name as a built in command by calling its name in another macro, Word runs the built-in command. If you run a macro using the ToolsMacro .Run WordBasic command and do not specify the .Show argument, the macro runs in the context specified the last time you chose Macro from the Tools menu.
Word versions 6.x, 7.xIf you run a macro using the ToolsMacro .Run command with the .Show argument 0, the macro runs according to Word's macro searching hierarchy. In the following example, Word looks for the macro first in the document template, then in Normal.dot, and finally in the built-in commands.
ToolsMacro .Name = "mymacro", .Show = 0, .Run Word for Windows version 2.xIf you run a macro using the ToolsMacro .Run command without the .Show argument AND have not previously chosen Macro from the Tools menu, the .Show argument defaults according to the .Store argument in the Template dialog box (accessed by choosing Template from the File menu). The .Store argument corresponds to the options in the Store New Macros And Glossaries As box. The .Store argument corresponds as follows to the .Show argument:
File Template Tools Macro ------------- ----------- Store New Macros and Glossaries as: Show: Global Global Template Template Prompt for Each New Previous SettingIf you want Word for Windows to follow the Template, Global, Built-in Command context hierarchy for macro execution in Word for Windows version 2.x (assuming the name is not the same as a built-in command), run your macro by calling its name rather than using the ToolsMacro statement.
REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, pages 210, 308 "Microsoft Word for Windows User's Guide," version 2.0, pages 705-706
|
Additional query words: winword2 wrong
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |