What do I do with macros sent to me by other users to help me out? 

I don't know how to install them and put them to use 

Article contributed by Dave Rado / updated by Lene Fredborg

STEP 1: Open the Macros dialog box

If you are in doubt what Word version you have, see How to find out what version of Word you have.

 

Word 2007 and later versions – how to open the Macros dialog box

In Word 2007 and later versions macros can only be stored in:

  • documents in .docm format
  • templates in .dotm format

You can access the macro tools from the Developer tab in the Ribbon. However, the Developer tab is not shown by default. See How to show the Developer tab in the Ribbon for help.

To open the Macros dialog box, select Developer tab > Macros
or press Alt+F8.
 



Go to STEP 2 below.

 

Word 2000-2003 – how to open the Macros dialog box

To open the Macros dialog box: Select Tools > Macro > Macros
or press Alt+F8.

Go to STEP 2 below.

 

STEP 2: Add and edit the macro

In the Macros dialog box, where it says Macros in, select the template or document you want to store the macro in; where it says Macro name, type a name, and click Create.

 

The Macros in field shows documents and templates that are currently open in Word and global templates.

 

 

In the VB editor that opens when you click Create, you will see something like this – any description you entered in the Description field will be shown as part of the green text:

 

Sub MyMacro()
'
' MyMacro Macro
'
'

End Sub

You can safely delete the green lines in the middle and add your own code or paste in the code sent to you by others. If code sent to you starts with a "Sub" line and ends with "End Sub", delete the "Sub" and "End Sub" lines that were added in the first place. Then select File > Save to save the macro in your document or template.

You can now run the macro. See STEP 3 below.

 

STEP 3: Run the macro

You can run the macro while you are still in the macro-editing window (normally referred to as the VB Editor or VBE) by pressing F5.  You can also size the VBE and the Word window on your screen so you can see them both at once, and step through the macro one line at a time, in order to see what it does, by pressing F8.

To run the macro from within Word, you can press Alt+F8 (or open the Macros dialog box as explained in STEP 1), find the macro in the list, and press Run.

But if you are likely to want to run the macro regularly, you can assign it to a keyboard shortcut, or to a toolbar, or a menu. Or, depending on what name you give your macro, you can assign it to certain events – see:

Intercepting events like Save and Print

Running a macro automatically when Word starts or quits

Running a macro automatically when a document is created, opened or closed

See also Bill Coan's excellent articles Creating a macro with no programming experience using the recorder and Getting To Grips With VBA Basics In 15 Minutes.

 

Overview of shortcuts

Shortcut To do this Where to use the shortcut
Alt+F8 Open the Macros dialog box In Word
Alt+F11 Open the VB editor In Word
F5 Run macro In the VB editor
F8 Step through macro In the VB editor


Click to view Terms of Use page

Click to view Disclaimer page