If you work with Microsoft Word a lot and find yourself doing the same things repeatedly, create a macro. Macro is a shortening of the word macroinstruction, which means a series of instructions to accomplish a task. 

The great thing about creating macros in Word is that you don’t need to know how to program. If you can press record and stop, you can do this.

Aren’t Macros Dangerous?

Have you heard about macros being bad because they can contain viruses? Although you do have to be careful about opening Office documents from unknown people because they might have malicious macros, that’s not an issue here. You make your own macro, so you know it’s not a virus.

How To Record A Macro in Word

For this example, you’re going to create a macro in Word to insert your signature at the end of a document.

  1. With Word open, go to the View tab.
  2. Select the down arrow under the Macros button.
  3. Select Record Macro… a new window will open.
  1. In the Macro name: field, enter a meaningful name for the macro. Spaces are not allowed. Use an underscore or dash.
  2. In the Store macro in: dropdown, you can select what documents you want this macro to be used. If you choose All Documents (Normal.dotm), the macro will be available to you in every new Word document you make from now on. If you choose a single document, it will only apply to that single document. It’s usually best to choose All Documents.
  1. In the Description:  field, write what the macro does. This is a simple macro with a descriptive name, but as you get confident with macros you’ll do more complex things, so a description is always a good idea.
  2. You can choose Assign macro to either a button you’ll create with the Button or hotkeys you can choose using the Keyboard button. There’s already a lot of shortcut keys for Word, so a button may be best. Select Button. A new window will open called Word Options.
  1. Here you’ll assign the macro a button on the Word Ribbon. Select Customize Ribbon.
  2. In the Choose commands from: dropdown, select Macros. This will show us our macros in the area beneath it.
  1. You need somewhere on the ribbon to put the macro. For this example, select Home in the Main Tabs area.  Then select New Group.
  2. Select Rename so you can give it a meaningful name.
  3. In the Rename window, select one of the icons to represent the group then enter My Macros in the Display name field.
  4. Select OK to apply it. You’ll see the change in the Main Tabs area.
  1. With the new My Macros selected in the Main Tabs area, select the Normal.NewMacros.Insert_Signature macro.
  2. Select Add to insert it into the My Macros group.
  1. Of course, you’ll want to rename it. With the macro selected in the Main Tabs area, select Rename…
  2. In the Rename window, select an icon and enter a simple name in the Display name: field.
  3. Select OK to commit the change. You’ll see the change in the Main Tabs area.
  4. Select OK below the Main Tabs area to finish creating the button for the macro.
  1. Go ahead and create whatever signature block you’d like. Add in a scan of your signature or other images. Whatever you’d like. When done that, select the down arrow under the Macros button.
  2. Select Stop Recording. That’s it. Your Insert Signature macro is made.
  1. Test it out by finding the Insert Signature button you created in the Home tab and select it. Your signature block should magically appear exactly as you designed it.

How To Write a Macro

For most macros, the recording method is the most efficient way to create them. Eventually, you’ll want to do something more complex. This requires writing the macro in the Visual Basic for Applications (VBA) language. We’ve got the best VBA guide for beginners, so bookmark that. Let’s create a macro to give us the average words per sentence to help us tell when we’re being wordy.

  1. You need access to the Developer tab which is hidden by default in Word. In the top-left corner of Word, select File.
  1. Near the bottom-left, select Options.
  1. In the window that opens, select Customize Ribbon.
  2. On the right side, look for Developer and put a checkmark next to it.
  3. Select OK to close the window. The Developer tab will now show.
  1. Select the Developer tab.
  2. Select the Macros button.
  1. Enter a meaningful name in Macro name: Leave the Macros in: as Normal.dotm so it will apply to all Word documents. Always enter a description in the Description: area.
  2. Select Create. The Microsoft Visual Basic for Applications development tool will open.
  1. The code that’s shown in the green rectangles below should already be there with some blank space between them. Copy and paste the following code into that space:

Dim s As Range
Dim numWords As Integer
Dim numSentences As Integer
numSentences = 0
numWords = 0

For Each s In ActiveDocument.Sentences
numSentences = numSentences + 1
numWords = numWords + s.Words.Count
Next

MsgBox “Average words per sentence” + Str(Int(numWords / numSentences)) + “. Less than 15 is best.”

  1. Select the Run button to test the code. If it doesn’t run as expected, edit the code until it runs the way you want.
  1. Select the Save button and close the development window.
  1. Create a button in the Word ribbon using the same method as shown in the “How to Record a Macro” instructions above.
  2. Find the button you just created and test it.

My Macro Doesn’t Work When I Save My Word Document

Word defaults to save with the file extension .docx, which doesn’t allow macros to automatically run. If you want the macro to run, you’ll need to change the file type to Word Macro-Enabled Document (*.docm).

This filetype exists partly to combat macro security issues. If you see this file extension on a document you weren’t expecting to receive, be suspicious.

What Else Can I Do With Macros?

You can create macros in Excel, Outlook, even PowerPoint. Anything that you’re currently doing manually, you should be able to record or write a macro to do it. Using macros in Word along with great Windows shortcut keys will amplify your productivity tenfold.