Create or run a macro

 Important    This feature isn’t available in Office on a Windows RT PC. Want to see what version of Office you're using?

To save time on tasks you do often, bundle the steps into a macro. First, you record the macro. Then you can run the macro by clicking a button on the Quick Access Toolbar or pressing a combination of keys. It depends on how you set it up.

Let’s start with the button setup.

  1. Click View > Macros > Record Macro.

Record Macro command

  1. Type a name for the macro.

Macro name box

  1. To use this macro in any new documents you make, be sure the Store macro in box says All Documents (Normal.dotm).

Box for choosing where to store a macro

  1. To run your macro when you click a button, click Button.

Click to assign the macro to a button

  1. Click the new macro (it’s named something like Normal.NewMacros.<your macro name>), and click Add.

The macro and the Add button

  1. Click Modify.

Modify button in the Customize the Quick Access Toolbar box

  1. Choose a button image, type the name you want, and click OK twice.

Button options in the Modify Button box

  1. Now it’s time to record the steps. Click the commands or press the keys for each step in the task. Word records your clicks and keystrokes.

 Note    Use the keyboard to select text while you’re recording your macro. Macros don’t record selections made with a mouse.

  1. To stop recording, click View > Macros > Stop Recording.

Stop Recording command

The button for your macro appears on the Quick Access Toolbar.

Macro button on the Quick Access Toolbar

To run the macro, click the button.

Create a macro with a keyboard shortcut

  1. Click View > Macros > Record Macro.

Record Macro command

  1. Type a name for the macro.

Macro name box

  1. To use this macro in any new documents you make, be sure the Store macro in box says All Documents (Normal.dotm).

Box for choosing where to store a macro

  1. To run your macro when you press a keyboard shortcut, click Keyboard.

Click to assign the macro to a keyboard shortcut

  1. Type a combination of keys in the Press new shortcut key box.
  2. Check to see whether that combination’s already assigned to something else. If it's already assigned, try a different combination.
  3. To use this keyboard shortcut in any new documents you make, be sure the Save changes in box says Normal.dotm.
  4. Click Assign.
  5. Now it’s time to record the steps. Click the commands or press the keys for each step in the task. Word records your clicks and keystrokes.

 Note    Use the keyboard to select text while you’re recording your macro. Macros don’t record selections made with a mouse.

  1. To stop recording, click View > Macros > Stop Recording.

Stop Recording command

To run the macro, press the keyboard shortcut keys.

Run a macro

Click the button or press the keyboard shortcut. Or you can run the macro from the Macros list.

  1. Click View > Macros > View Macros.

View Macros command

  1. In the list under Macro name, click the macro you want to run.
  2. Click Run.

Make a macro available in all documents

To make a macro from one document available in all new documents, add it to the Normal.dotm template.

  1. Open the document that contains the macro.
  2. Click View > Macros > View Macros.

View Macros command

  1. Click Organizer.

Organizer button in the View Macros box

  1. Click the macro you want to add to the Normal.dotm template, and click Copy.

Add a macro button to the ribbon

  1. Click File > Options > Customize Ribbon.
  2. Under Choose commands from, click Macros.
  3. Click the macro you want.
  4. Under Customize the ribbon, click the tab and custom group where you want to add the macro.

If you don't have a custom group, click New Group. Then click Rename and type a name for your custom group.

  1. Click Add.
  2. Click Rename to choose an image for the macro and type the name you want.
  3. Click OK twice.
 
 
Applies to:
Word 2013