You can run macros using the Macro dialog box (Tools menu), or you can run them using menu, toolbar, and shortcut key assignments. To use the Macro dialog box to run a macro, select the one you want to run, and then choose the Run button.
The list of macros displayed depends on the setting in the Macros Available In box. By default, the list shows all available macros, which includes the macros stored in the Normal template and any other open templates. If you choose, you can list just the macros stored in a particular template. You can also list all the built-in Word commands. If you have removed a macro or Word command from its menu, toolbar, or shortcut key assignment, you can still run it using the Macro dialog box.
Because you've already assigned the BoldItalic macro to a key combination, there's no need to use the Macro dialog box; you can run the macro directly from your document.
Û To run the BoldItalic macro
1. Select some text in a document.
2. Press Ctrl+Shift+B (Windows) or command+Shift+B (Macintosh).
The bold and italic formats are applied.
Now try an experiment. With the text still selected, choose Undo from the Edit menu. Apply a different font to the selection, and then press the shortcut keys assigned to the BoldItalic macro (Ctrl+Shift+B in Windows; command+Shift+B on the Macintosh).
Notice that the font changes back to whichever font the text had when you recorded the macro. This happens because the macro recorder records all the settings in a dialog box when it records a command. In this case, it recorded the current font when you recorded the macro, so now when you run the macro, it applies that font to the selected text.
What you want the macro to do is just apply bold and italic formatting and ignore any other character formatting. To achieve this result, you need to edit the macro. This process is described in the next section, "Editing a Macro."
Other Ways to Run Macros You can run macros in several other ways, most of them in response to specific events that can trigger macros. The command line. In Windows, you can add the name of a macro to the Word command line so that the macro will run when Word starts. You can modify the Word command line by selecting the Word icon in Program Manager (Windows 3.x and Windows NT) or the Word shortcut icon in the Programs subfolder in the Start Menu folder (Windows 95) and choosing the Properties command from the File menu. Here is the syntax for starting a macro using the command line: winword /mMacroName MacroName is the name of the macro that runs when Word starts. Each icon in Program Manager or shortcut icon on the Start Menu can have a different command line, so you can create different Word icons that launch different macros when Word starts. The Macintosh does not provide a command line, but you can use the Word Settings (6) file to designate a macro to run when Word starts. You can access this file through the ToolsAdvancedSettings command. (To run the command, select ToolsAdvancedSettings from the list of Word commands in the Macro dialog box (Tools menu), and then choose the Run button.) In the Advanced Settings dialog box, select Microsoft Word from the Categories list, and then type WordSwitches in the Option box; in the Setting box, type /mMacroName where MacroName is the name of the macro to run when Word starts. Then choose the Set button. Auto macros. Auto macros are macros that run automatically when you create a new document, open an existing document, and so on. For more information, see "Auto Macros" later in this chapter. MACROBUTTON fields. These fields launch macros when they are double-clicked, and can be inserted anywhere in a document. Form fields. A form field can trigger a macro when the field is selected ("on entry") and after it has been modified ("on exit"). For information on running macros from form fields, see "Automating Forms" in Chapter 9, "More WordBasic Techniques." |