How to Create a Macro in Microsoft Word

If you find yourself performing the exact same sequence of formatting actions in Microsoft Word every day—such as inserting a specific company header, changing the font size, adjusting the margins, and adding a watermark—you are wasting valuable time. Instead of clicking through five different menus every time you create a new document, you can automate the entire process using a Macro. A Macro is essentially a recording device built into Word. It records your keystrokes and mouse clicks, saves them as a script, and allows you to replay that exact sequence instantly with a single button press or keyboard shortcut.

Prerequisite: Enabling the Developer Tab

To create and manage Macros effectively, you need access to the Developer tab, which is hidden by default.

  1. Open Word, click the File tab, and select Options at the bottom left.
  2. Click Customize Ribbon in the left sidebar.
  3. In the right-hand column (“Main Tabs”), check the box next to Developer.
  4. Click OK. The Developer tab will now appear on your main ribbon.

Step-by-Step: Recording a Macro

Recording a Macro requires planning. Once you hit ‘Record’, Word tracks every action you take. If you make a mistake and undo it, the Macro records the mistake and the undo action. Know exactly what steps you intend to take before starting.

  1. Go to the Developer tab on the ribbon.
  2. In the ‘Code’ group on the far left, click Record Macro.
  3. A dialogue box will appear.
    • Macro name: Give it a descriptive name (e.g., FormatDailyReport). Note: The name cannot contain any spaces.
    • Store macro in: Leave this set to “All Documents (Normal.dotm)” if you want this Macro available in every future Word document you open.
    • Description: Add a quick note about what it does.
  4. Assign macro to: You must choose how you will trigger the Macro later. Click Keyboard.
  5. The Customize Keyboard dialogue box opens. Click inside the “Press new shortcut key” box and press a combination on your keyboard that isn’t already used (e.g., Alt + Shift + F). Click the Assign button, then click Close.

Your mouse cursor will now have a tiny cassette tape icon attached to it. You are now recording.

Perform the actions you want to automate. (For example: Change the font to Arial, set size to 14, apply Bold, and center align the text). When you are completely finished, go back to the Developer tab and click Stop Recording.

Running Your Macro

Now that the sequence is saved, test it.

  1. Open a new, blank document and type some raw text.
  2. Press the keyboard shortcut you assigned earlier (e.g., Alt + Shift + F).
  3. Word will instantly execute all the formatting steps you recorded in a fraction of a second.

Troubleshooting and Macro Security

Because Macros use VBA (Visual Basic for Applications) scripts, they are a common vector for computer viruses. Cybercriminals often hide malicious code inside Macros attached to downloadable Word documents.

  • Security Warnings: By default, Word disables Macros originating from the internet. If you open a document from an external source that contains a Macro, a yellow security bar will appear at the top of the screen asking you to “Enable Content.” Never enable Macros unless you completely trust the sender.
  • Editing a Mistake: If you made a mistake while recording, it is almost always faster to delete the Macro and record it again from scratch, rather than trying to edit the underlying VBA code (unless you know how to program). To delete a Macro, go to Developer > Macros, select it from the list, and click Delete.

By leveraging Macros for repetitive formatting tasks, you transition from a casual Word user to an efficient power user, saving hours of tedious clicking over the course of a year.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.