Datasheet
Macro Recording Tips
562
Macro Recording Tips
Here are some tips to keep in mind as you record macros:
✦ You can call up the Record Macro dialog box directly by clicking the
Record Macro button on the status bar. It appears as a little red dot.
✦ If the macro doesn’t work, you might have made a mistake while record-
ing it. If the macro is short enough, the best thing to do is to record the
macro again. If the macro is long and you don’t have anything important
to do, try editing the macro to expunge the problem. See the section
“Editing a Macro” later in this chapter.
✦ Macros are normally stored in the global Normal.dotm template. To store
a macro in the template attached to the current document, change the set-
ting of the Record Macro dialog box’s Store Macro In drop-down list.
✦ Don’t make any assumptions about where the insertion point will be
when you run the macro. If necessary, begin the macro with a position-
ing command by moving the insertion point to the beginning of the doc-
ument, the beginning of the line, or the beginning of a word. (Not all
macros require a positioning command. But if your macro depends in
any way on the position of the insertion point, this step is a must.)
✦ Don’t use the mouse to select text or navigate through the document.
Word doesn’t record these mouse actions. You can use the mouse to
select Ribbon commands, but not to move the insertion point.
✦ Use Ctrl+Home or Ctrl+End to move to the beginning or end of a docu-
ment. Don’t use repeated Page Up or Page Down keys for this purpose.
Pressing Page Up three times might get you to the top of your document
when you record the macro, but when you run the macro, it might not.
Similarly, use Home and End to move to the start or end of a line rather
than the left or right arrow keys.
✦ If you use the Find or Replace commands, be sure to move to the begin-
ning of the document first.
✦ Avoid any commands that depend on the contents of a document that’s
active when you record the macro. If your macro is based on informa-
tion that will never be replicated, it’s a pretty useless macro.
Running a Macro
If you assigned a macro to the Quick Access toolbar, the Ribbon, or a key-
board shortcut, you can run the macro by clicking the QAT button, choosing
50_040584 bk09ch01.qxp 12/28/06 9:28 PM Page 562