In Word, you can automate frequently used tasks by creating and running macros. A macro is a series of commands and instructions that you group together as a single command to accomplish a task automatically.
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.
-
Select View > Macros > Record Macro.
-
Type a name for the macro.
-
To use this macro in any new documents you make, be sure the Store macro in box says All Documents (Normal.dotm).
-
To run your macro when you click a button, select Button.
-
Select the new macro (it's named something like Normal.NewMacros.<your macro name>) and select Add.
-
Select Modify.
-
Select a button image, type the name you want, and select OK twice.
-
Now it's time to record the steps. Select 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.
-
To stop recording, select View > Macros > Stop Recording.
The button for your macro appears on the Quick Access Toolbar.
To run the macro, select the button.
-
Select View > Macros > Record Macro.
-
Type a name for the macro.
-
To use this macro in any new documents you make, be sure the Store macro in box says All Documents (Normal.dotm).
-
To run your macro when you press a keyboard shortcut, select Keyboard.
-
Type a combination of keys in the Press new shortcut key box.
-
Check to see whether that combination's already assigned to something else. If it's already assigned, try a different combination.
-
To use this keyboard shortcut in any new documents you make, be sure the Save changes in box says Normal.dotm.
-
Select Assign.
-
Now it's time to record the steps. Select 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.
-
To stop recording, select View > Macros > Stop Recording.
To run the macro, press the keyboard shortcut keys.
To run a macro, select the button on the Quick Access Toolbar, press the keyboard shortcut, or you can run the macro from the Macros list.
-
Select View > Macros > View Macros.
-
In the list under Macro name, select the macro you want to run.
-
Select Run.
To make a macro from one document available in all new documents, add it to the Normal.dotm template.
-
Open the document that contains the macro.
-
Select View > Macros > View Macros.
-
Select Organizer.
-
Select the macro you want to add to the Normal.dotm template, and then select Copy.
-
Select File > Options > Customize Ribbon.
-
Under Choose commands from, select Macros.
-
Select the macro you want.
-
Under Customize the ribbon, select the tab and custom group where you want to add the macro.
If you don't have a custom group, select New Group. Then select Rename and type a name for your custom group.
-
Select Add.
-
Select Rename to select an image for the macro and type the name you want.
-
Select OK twice.
-
On the Developer tab, in the Code group, select Macros.
-
In the Macro name box, type a name for the macro.
Note: If you give a new macro the same name as a built-in macro in Word, the new macro actions will replace the built-in macro. To view a list of built-in macros, select Word Commands in the Macros in dropdown list.
-
In the Macros in list, select the template or document in which you want to store the macro.
To make your macro available in all documents, be sure to select Normal.dotm.
-
Select Create to open the Visual Basic Editor.
After you open the Visual Basic Editor, you might want more information about working with Visual Basic for Applications. For more information, select Microsoft Visual Basic Help on the Help menu or press F1.
To make quick work of tasks that you do often, in the desktop version of Word you can bundle the steps into macros that run with a single click. In Word for the web, you have to step through such tasks manually.
If you have Word, first select Open in Word to open your document in Word. On the upper-right corner of the browser page, select Editing > Open in Desktop App.

Then, follow the instructions for the desktop version of Word.
When you run the macro in Word and save the document, you'll see the results of the macro when you reopen your document in Word for the web.