How to Use Macros in Word: A Step-by-Step Guide to Automation

In desktop Word, a macro can repeat a series of commands. Start with a small, predictable task and test it on a copy of a document before using it on important work. Word for the web cannot record or run macros; open the file in desktop Word for this workflow.

Record a simple macro in Word for Windows

  1. Open a test document. Choose View > Macros > Record Macro.
  2. Give the macro a clear name. Choose where to store it: All Documents (Normal.dotm) makes it available in future documents on that computer, while a document or template limits its scope.
  3. Optionally assign a button or keyboard shortcut. Check that the shortcut is not already in use.
  4. Perform the commands you want to automate, then choose View > Macros > Stop Recording.
  5. Run it using the assigned button or shortcut, or choose View > Macros > View Macros, select it, and choose Run.

Microsoft’s macro instructions document these paths. They also note that mouse-based text selections are not recorded; use keyboard selection when a recorded step must select text. The Developer tab offers additional macro tools; our Developer tab guide shows how to reveal it.

Store and share the macro appropriately

A macro saved in Normal.dotm is available in that Word installation, not automatically on every computer or in every shared document. If the macro belongs with a document, use a macro-enabled Word file format such as .docm; a regular .docx does not preserve embedded VBA macros. Confirm the saved file type and test on the recipient’s Word version.

Macro security

Macros can run code, so do not enable or run one from an unexpected document merely to make a warning disappear. Verify the source and your organization’s policy first. Microsoft’s macro security guide explains the warning and trust settings. Do not lower global macro protection to troubleshoot a single file.

Advertisements