10 Using Macros

Difficulty Level: Advanced
Word Version: XP
Assumed Knowledge: Beginner

 

 

The aim of the tutorial is to:

 

Explain the benefits of using macros and creating your own ones.

 

 

What Macros are

Macros enable you to quickly edit or format Word documents that are to be editted or formatted in the same ways. A macro is a recording of the sequence of menu selections that you make. You can then run the macro so that the sequence of menu selections can be performed in one go without you having to select them all over again.

Recording a Macro

A macro can be assigned to either the toolbar or the keyboard.

To record a macro and assign it to a toolbar:

  1. Click on Tools on the menu bar.
  2. In the pop-down menu move the pointer to Macro.
  3. In the next pop-down click on Record New Macro...
    The Record Macro box shown below will appear on the screen:
  4. Name the macro in the Macro name field.
    The name should be something that you will easily recognise in future and know what the macro will do. For example, if it is a layout you want to use when writing a formal letter you might want to call it 'FormalLetter'. The name cannot contain spaces or begin with a number.
  5. In the Store macro in drop-down box, select the document you would like the macro to be associated with or choose All Documents be able to use the macro in any document.
  6. Enter a description of the macro in the Description field. This is for your reference only so you remember what the macro does.
  7. Click on the Toolbars icon:

  8. The macro Customize box will appear on the screen. In this box enxure that the Commands tab is uppermost:


    Two windows are shown - Categories on the left and Commands on the right.
    In the Commands window will appear the words Normal.NewMacros followed by the name you have given to the macro, in this case FormalLetter.
  9. Click on this command and drag it on to a toolbar where you want it to appear. The name of the macro will appear on the toolbar.
  10. Click on Close to close the Customize box.
    The pointer will have a cassette attached to it and the Recording toolbar will appear on the screen:

    This toolbar allows your to stop, pause and continue recording a macro.
  11. Perform all the commands in order. Select options from the drop-down menus and Word will record the options you choose from the boxes, such as changing the margins on the Page Setup window. The only options that will be recorded in the macro will be the ones that modify the document. Word will not record actions such as clicking on View and then clicking on Toolbars because as these have no effect on the document itself.
  12. Click on the Stop symbol on the recording toolbar to finish recording. The macro will be saved.

To record a macro and assign it to the keyboard:

  1. Click on Tools on the menu bar.
  2. In the pop-down menu move the pointer to Macro.
  3. In the next pop-down click on Record New Macro...
    The Record Macro box shown below will appear on the screen.
  4. Name the macro in the Macro name field.
  5. In the Store macro in drop-down box, select the document you would like the macro to be associated with or choose All Documents be able to use the macro in any document.
  6. Enter a description of the macro in the Description field.
  7. Click on the Keyboard icon.
    The macro Customize Keyboard box will appear on the screen:

    Four windows are shown - Categories on the top left, Commands on the top right, Current Keys on the bottom left and Press new shortcut key: on the middle right.
  8. In the Press new shortcut key: window press on the keys you want to assign the macro to.
    Shortcut keys usually include the Control key or Alt key followed by a letter or number. In Word most letters are already assigned with Control to a macro so it is best to assign letters with Alt to a macro.
    If your choice of keys are currently assigned to an existing macro then this will appear in the box and you should type in new shortcut keys. Otherwise the words [unassigned] will appear in the box.
  9. Save the macro either in the Normal template or another option in the drop down menu.
  10. Click on Assign.
    The key command will appear in the Current keys: window.
  11. Close the Cutomize Keyboard box.
    The pointer wil have a cassette attached to it and the Stop Recording toolbar will appear on the screen.
  12. Perform all the commands in order.
    Select options from the drop-down menus and Word will record the options you choose from the boxes, such as changing the margins on the Page Setup window.
  13. Click on the Stop symbol on the recording toolbar and the macro will be saved.

Running a Macro

A macro can be performed using either the toolbar menu, a toolbar button or the keyboard.

To run an existing macro using the toolbar menu:

  1. Click on Tool on the menu bar.
  2. In the pop-down highlight Macro.
  3. In the next pop-down menu click on Macros.
  4. The Macros box shown below will appear on the screen.
  5. Highlight the name of the macro in the list and click on Run.
    If the macro is long and you want to stop it while it is running, press Break (hold down the Ctrl key and press the Pause key).

To run a previously recorded macro assigned to a toolbar:

  1. Click on the macro button on the toolbar.
  2. If the macro is long and you want to stop it while it is running, press Break (hold down the Ctrl key and press the Pause key).

To run previously recorded macro assigned to the keyboard.

  1. Press the keys that the macro was assigned to.
  2. If the macro is long and you want to stop it while it is running, press Break (hold down the Ctrl key and press the Pause key).

Exercises

  1. Open a new document and record a macro called 'MarginsAndFont' so that all 4 margins on the page are 3cm, and the font for the whole document will be Arial Black, size 14.


  2. Run the Macro.


  3. Type in the months of the year in a bulleted list:


  4. Close the document.

Back to Word Home Page