Datasheet

Book IX
Chapter 1
Recording and
Using Macros
Running a Macro
563
the Ribbon command, or pressing the keyboard shortcut. If you didn’t, you
can run it by following these steps:
1. Select the Developer tab on the Ribbon and then click the Macros
button in the Code group.
The Macros dialog box, shown in Figure 1-3, appears.
As a shortcut, you can press Alt+F8.
Figure 1-3:
The Macros
dialog box.
Avoiding unexpected side effects
Sometimes a macro has unexpected side
effects. Suppose that rather than record the
keystrokes Ctrl+B and Ctrl+I for the
BoldItalic
macro, you decide to record these steps
instead:
1. Call up Format
Font.
2. Choose Bold Italic as the font style.
3. Click OK.
The macro seems to work, but sooner or later,
you discover that in addition to recording the
Bold Italic font style, the macro recorded other
character attributes — such as font, size, and
effects. If the text to which you applied the
Format
Font command when you recorded
the macro was 10-point Times New Roman font,
every time you apply the macro, the font is
switched to 10-point Times New Roman.
You can avoid these side effects in two ways:
Avoid recording dialog boxes in macros
whenever a keyboard shortcut or a Ribbon
button can do the trick. Whenever you
record a dialog box in a macro, you record
all the dialog box’s settings.
Fix the macro later by editing it and remov-
ing the extraneous information. See the
section “Editing a Macro.”
50_040584 bk09ch01.qxp 12/28/06 9:28 PM Page 563