How to Create a Word 2007 Macro - dummies

By Doug Lowe

The easiest way to create a macro in Word 2007 is to use the macro recorder. After you turn on the macro recorder, it makes a precise record of everything you do in Word until you turn off the recorder. After you turn off the recorder, you can replay the recorded macro to repeat the exact sequence of steps that Word recorded in the macro.

About the only things that are not recorded by the macro recorder are mouse movements within the document. The macro recorder records buttons or Ribbon choices you click, but Word won’t let you navigate about your document or select text with the mouse while the macro is recording. As a result, use the keyboard for navigating or selecting text while recording a macro.

To record a macro, follow these steps:

  1. Think about what you’re going to do.

    Think through all the steps you have to follow to accomplish whatever task you want to automate with a macro. If necessary, rehearse the steps before you record them as a macro.

  2. Click the Developer tab on the Ribbon and then click the Record Macro button in the Code group.

    The Record Macro dialog box appears.

    The Record Macro dialog box.
    The Record Macro dialog box.

    If the Developer tab isn’t visible, choose Office→Word Options to summon the Word Options dialog box. Then, click the Personalize tab and select the Show Developer Tab in the Ribbon check box.

  3. Type the name of the macro you want to create in the Macro Name text box.

    The name can be anything you want, but it cannot include spaces, commas, or periods.

    If the function of the macro isn’t obvious from the macro name, type a more elaborate description of the macro in the Record Macro dialog box’s Description field. You’ll thank yourself later when you forget what the macro does.

  4. To make your macro accessible from a toolbar or the keyboard, click the Button or Keyboard button.

    This step calls up the Customize dialog box, which is ready to add your macro to the Quick Access Toolbar or a keyboard shortcut. Click the Keyboard button and type the shortcut key combination you want to assign to the macro, click the Assign button and then click Close.

    Assigning a macro to a keyboard shortcut.
    Assigning a macro to a keyboard shortcut.

    If you click the Button button instead, the Word Options dialog box appears with the Customize tab selected. Then, you can create a button on the Quick Access toolbar to run the macro.

  5. Set the Store Macro In drop-down list to where you want to store the macro.

    The default setting stores the recorded macro in the Normal.dotm template so that it’s always available. The other choices available in this drop-down list are storing the macro in the document that you were working on when you called up the macro recorder or storing the macro to the template that document is based on.

  6. Click OK to begin recording the macro.

  7. Type the keystrokes and Ribbon commands you want to record in the macro.

  8. If you have to stop recording temporarily, click the Pause button. Click it again to resume recording.


    You might forget how to do something, for example, especially if you skipped Step 1. If you click the Pause button, you can call up Word’s Help command, look up the procedure for whatever it is you forgot, dismiss Help, and click the Pause button again to resume recording.

  9. After you finish recording the macro, click the Stop button.


    Word adds the macro to the template or document. You’re almost done.

  10. Test the macro.

    If you assigned the macro to a keyboard shortcut, use the shortcut now to see whether the macro works.