How to Create and Use a Macro in Microsoft Word


In this tutorial you will learn how to create an use macro in Microsoft Word

Macro is one of the more powerful features of Microsoft Word; so powerful, that in fact at some point it asked itself to be disabled because people were writing various forms of code and distributing it in document disguise. The power of Word macros comes from the fact that they are in fact full Visual Basic scripts, not just a sequence of recorder commands.

Prerequisites: Microsoft Word

Step 1. In order to use the macro features, we need first to get access to them. This is done by customizing Word’s toolbar, which it’s called Ribbon:

Select File – Options’

Select Customize Ribbon.

customize Word toolbar

Step 2. From „Customize the Ribbon” section, at the main tab, click Insert, and then New Group to add your macro group. Click Rename, and call it Macros. Scroll in the list on the left until you find the Macros command. Add them to your Macros Group by clicking the Add button in the middle.

Click OK.

add macro group

Step 3. Go back to your text document. Click Insert.

As you can see, on the right side of your Ribbon there is a new option, called Macros.

Great, we now have access to them.

click insert

Step 4. Click it to enter Macro mode. Word will ask you for a new name to be assigned to your macro.

Give it a name and click Run. The Visual Basic interface loads up.

Step 5: While being powerful, the interface can be disorienting for a non-programmer. If you are a programmer, you will know very well what you have to do here.

For everyone else, here’s what we do: close the visual basic interface and come back to the text document.

Click View. At the end of this ribbon there is also a Macros menu.

Click the little triangle beneath the Macros label. From the menu that appears, choose Record Macro..

You can put this macro on a button, or store it into the document you have opened.

Step 6: Optionally, enter a description for your Macro.

Start performing your macro in the order you want.

add description to macro

Step 7: When you’re done, go again to the Menu beneath Macros and choose Stop Macro.

You can run your macro anytime by choosing Macro – View Macros and clicking Run, or you can Edit it into the environment we saw earlier. You can also assign a hotkey to it, making its invocation easier.

customizing macro

Step 8: Now go back to your document. Choose File – Save. Once you save the document, your macro will be saved with it.

Result: Congratulations! You have learnt how to create and use a macro in Microsoft Word.