Datasheet

Editing a Macro
564
2. If the macro you want to run isn’t already selected, select it now. If the
macro you want doesn’t appear, try changing the Macros In setting.
The macro might be in a different template.
3. Click Run.
Editing a Macro
If you make a mistake while recording a macro, you can abandon the record-
ing and start over. Or you can finish the recording and edit the macro to cor-
rect the mistake. When you edit the macro, the macro’s commands appear in
a separate window. You can delete or modify erroneous commands, you can
insert new commands if you know how, or you can merely study the macro
to try to figure out how it works.
When you edit a macro, you’re exposed to Visual Basic for Applications
(VBA). VBA is not as deadly as the Ebola virus, but it can cause severe
headaches and nausea if you’re not inoculated with the Programmer
Vaccine. For more information about VBA and its editor, turn to Chapter 2 of
this minibook.
Here are the steps for editing a macro:
1. Click the Macros button on the Developer tab on the Ribbon or on the
status bar.
The Macros dialog box appears. (Refer to Figure 1-3.)
2. Select the macro you want to edit and click the Edit button.
Word launches the Visual Basic editor, with the macro you selected visi-
ble in its own window. See Figure 1-4.
Notice that the Visual Basic editor uses good old-fashioned menus
instead of the new-fangled Ribbon.
3. Make whatever changes are necessary to the macro.
Correct misspelled words, delete extraneous commands, and if you’re
brave, add more commands.
4. Choose FileSave Template to save your changes.
5. Choose FileClose to close the macro window.
50_040584 bk09ch01.qxp 12/28/06 9:28 PM Page 564