How to Create Macros in Microsoft Word

Save time by using these handy task shortcuts

A macro is a series of commands that is recorded so it can be played back (executed) at a later time. Macros are great for reducing the amount of work you have to do on a series of steps that you perform frequently. Here's how to create and test a macro in Microsoft Word.

Instructions in this article apply to Word for Office 365, Word 2019, Word 2016, Word 2013, and Word 2010.

Why Use a Macro

With a macro, you can get the same results by clicking a command instead of going through all the steps. Some ways to use macros to increase your productivity include:

  • Insert your company logo and name in a particular typeface.
  • Insert a table that you need to create regularly.
  • Format a document with certain characteristics, such as page numbering and double-spaced paragraphs.

Creating and using macros is a learned skill but the resulting efficiency is well worth the effort.

Create a Macro

There are more than 950 commands in Word, most of which are on menus and toolbars and have shortcut keys assigned to them. Some of these commands, however, are not assigned to menus or toolbars by default. Before you create your own Word macro, check to see if it exists and can be assigned to a toolbar.

To see the commands available in Word, follow these steps:

  1. Select the View tab.

    Word with the View tab highlighted
  2. Choose Macros.

    View ribbon in Word with the Macros heading highlighted
  3. Select View Macros.

    Or, press the Alt+F8 shortcut key to access the Macros dialog box.

    Macros menu in Word with the View Macros command highlighted
  4. Select the Macros in drop-down arrow and choose Word Commands.

    Macros menu with the Word Commands option highlighted
  5. In the alphabetical list of command names, highlight a name to display a description of the command at the bottom of the Macros dialog box under the Description label.

    Macros screen in Word with ListCommands highlighted

If the command you wish to create exists, don't duplicate it with your own Word macro. If it doesn't exist, proceed with creating your Word macro.

Plan for Effective Word Macros

The most important step in creating effective Word macros is careful planning. This planning includes having a clear idea of what you want the Word macro to perform, how it will make your future work easier, and the circumstances under which you intend to use it.

Once you have these things in mind, plan the actual steps. This is important because the recorder will remember everything you do and include it in the macro. For example, if you type something and then delete it, every time you run that macro, Word will make the same entry and then delete it, making a sloppy and inefficient macro.

When you plan your macros, here are some things to consider:

  • Plan the commands and the order in which you want the macro to perform the commands.
  • Know the shortcut keys for the commands you plan to use. This is particularly important for navigation as you aren't able to use the mouse for navigation within the document area when you run the recorder. Further, you will create a leaner macro if you use a shortcut key rather than the arrow keys.
  • Plan for messages that Word might display and that will stop the macro.
  • Use as few steps as possible to keep the macro efficient.
  • Do at least one test run before you start recording.

After you’ve planned your Word macro and done a run-through, you're ready to record it. If you’ve planned your macro carefully, recording it for later use will be the easiest part of the process. The only difference between creating a macro and working on the document is that you have to press a few extra buttons and make a couple of selections in dialog boxes.

Record the Macro

When you start recording a macro, the mouse pointer has a small icon that looks like a cassette tape beside it, indicating that Word is recording your actions. You can then follow the steps you laid out in the planning stage. Once you are done, press the Stop button (it is the blue square on the left). Once you press the Stop button, your Word macro is ready to use.

Here's how to record a macro.

  1. Go to the View tab, select Macros, then choose Record Macro to open the Record Macro dialog box.

    Record Macro command in Word
  2. In the Macro Name text box, type a unique name.

    Names can contain up to 80 letters or numbers (no symbols or spaces) and must begin with a letter. The name should be unique so that you can determine what it does without having to refer to the description.

  3. In the Description text box, enter a description of the actions the macro performs.

    New Macro window in Word with the Macro Name and Description fields highlighted
  4. Select whether you want the macro to be available in all documents or only in the current document. If you choose to limit the availability of the command, highlight the document name in the Store Macro in drop-down menu.

    By default, Word makes the macro available to all your documents, and you will probably find that this makes the most sense.

    New Macro window in Word with the
  5. When you have entered the information for the macro, select OK. The Record Macro Toolbar appears in the upper-left corner of the screen.

    Record Macro window in Word with the OK button highlighted

To pause the recording, select the Pause Recording/Resume Recorder button (it is the one on the right). To resume recording, select it again.

Test the Macro

The purpose behind creating macros in Word is to speed up your work by putting repetitive tasks and complex sequences of commands at your fingertips. Make sure your macro runs as intended by testing the macro.

  1. To run the macro, press the Alt+F8 shortcut key to display the Macros dialog box.

    Screenshot of Macros dialog box
  2. Highlight the macro in the list, then select Run.

    Macros window in Word with the Run button highlighted

If you don’t see your macro, make sure the correct location is in the Macros in box. 

Create Keyboard Shortcuts for Macros

If you created several macros, searching through the Macros dialog box takes time. If you assign macros a shortcut key, you can bypass the dialog box and access your macro directly from the keyboard in the same way you use shortcut keys to access other commands in Word.

  1. Select File, then choose Options.

    Word with the Options button highlighted
  2. In the Word Options dialog box, go to the left pane and select Custom Ribbon.

    Word Options with the Customize Ribbon section highlighted
  3. Select Customize.

    Macros in Word with the Customize button highlighted
  4. In the Categories list, scroll down to Macros and select the macro for which you want to create a new shortcut.

    If the macro currently has a shortcut key assigned to it, the shortcut will appear in the box below the Current keys label.

    Macro customization menu with the Categories heading highlighted
  5. If no shortcut key has been assigned to the macro, or if you want to create a second shortcut key for the macro, select the Press new shortcut key text box.

    Press new shortcut key menu in Word
  6. Enter the shortcut key you want to use to access your macro.

    If the shortcut key is assigned to a command, a message says Currently assigned to followed by the name of the command. Either reassign the shortcut key by continuing, or select a new shortcut key.

  7. Select the Save changes in drop-down arrow and choose Normal to apply the change to all documents created in Word.

    To use the shortcut key only in the current document, select the document name from the list.

  8. Select Assign.

    Assign button in Word macro settings
  9. Select Close to save your changes.

    Close button in Word macro settings