Home > Sample chapters > Microsoft Office > Word

Customizing and Securing Microsoft Word 2010

Creating a Macro

You can automate procedures you follow often by creating a macro to record the keystrokes and menu selections and then playing them back by pressing a single key combination. For example, you could create a macro by recording the replacement of a phrase and/or a style using the Replace command. Then you can run that macro to modify other documents. Regardless of the complexity of your macro, you can run it as though it were a single Word command.

Create a Macro

  1. Click the View tab, click the Macros arrow in the Macros group, and choose Record Macro to display the Record Macro dialog box.

    httpatomoreillycomsourcemspimages676043.jpg
  2. Type a name for the macro. (The name must begin with a letter and can’t contain any spaces or symbols.)

  3. Choose whether you want to assign the macro to a button or the keyboard.

  4. Specify where you want to store the macro and type a description.

  5. Click OK.

    httpatomoreillycomsourcemspimages676045.jpg
  6. Execute the series of actions you want to record as a macro, using your keyboard to select text and to move the insertion point. (Note that other than when you click a command, most mouse actions aren’t recorded.)

  7. When you’ve completed the series of actions, click the Macros arrow again and choose Stop Recording.

    httpatomoreillycomsourcemspimages676047.jpg
  8. Click Macros to display the Macros dialog box, select the macro you just recorded and click Run to make sure the macro performs correctly.