Advertisment

Macros in Word

author-image
PCQ Bureau
New Update

Ignorance

is no longer bliss. Those of you, who’ve been ignorant of macros in Office

suites, might have spent endless hours in manually performing a series of

repetitive tasks to accomplish your goal. But, did you know that you could

automate your tasks by creating a custom command or a macro? If you were

indeed aware of it, did you know how to create a macro?

Advertisment

If not, read on. Here we’ll

look at how to create macros in Word 2000. Creating macros in other Office

suites works in much the same way.

What’s a macro?

In simple

terms, macros are like batch files. They’re a series of commands grouped

into one. For example, if you frequently change the formatting of text in a

Word document, then instead of selecting options in dialog boxes, you can

create a macro that’ll do all these steps simultaneously.

Advertisment

There are two ways to create

macros in Word–the Visual Basic editor and the Macro recorder.

The Visual Basic editor is

used for editing and debugging Visual Basic for Applications (VBA)–a

programming language that’s designed specifically for Office applications

and has its roots in Visual Basic. So, if you’re familiar with

programming, you can use the Visual Basic editor to create powerful macros.

If you aren’t a programmer, you can still use the Macro recorder. The

Macro recorder automatically translates your actions into Visual Basic code,

which you can later edit using the Visual Basic editor.

Here, we’ll use the Macro

recorder.

Advertisment

Start Word. From the Tools

menu, select Macro>Record New Macro

You’ll come across the

"Record Macro" dialog box.

  • Enter a name for the

    macro in the Macro name box.



  • In the "Store macro

    in" box, select a template or document in which you wish to store

    the macro. By default, Word stores macros in the Normal template, so

    that they’re available for use with every Word document. However, if

    you wish to use a macro in a single document, store it in that document

    only. If the macro is to be used in a set of documents that use a common

    template, then you can store the macro in that template instead of

    Normal.dot



  • l In the description box,

    describe your macro for later reference

Advertisment

Note:

Word comes with a few built-in macros. So, if your macro name is the

same as an existing built-in macro, the new macro action will replace the

existing actions. To view a list of built-in macros, go to

Tools>Macro>Macros. In the "Macros in" list, click Word

commands. You’ll come across a list of built-in macros.

For quick access, it’s a

good idea to associate your macro with a keyboard shortcut or a toolbar

button.

Advertisment

Keyboard shortcut

A keyboard

shortcut is basically a combination of two keys, like Alt+G or Ctr+A, etc.

To create a keyboard

shortcut, click on the Keyboard icon from the Record Macro screen.

Advertisment

You’ll come across the

Customize Keyboard dialog box.

Press the key combination you

wish to associate with your macro. If an existing command or macro is

already assigned to the shortcut you choose, Word lists it below the

"Press new shortcut key" box. So, after assigning an unassigned

keyboard shortcut, click Assign.

Toolbars buttons

Advertisment

If you want

to call up your macro using your mouse, you need to create a toolbar button

for it. To create a toolbar button, click on the Toolbars icon from the

Record Macro screen.

You’ll come across the

Customize dialog box.

Click the Commands tab and

drag the macro from the Command list to the toolbar on which you want to

place the button.

To rename the button, click

Modify selection and enter a name in the Name text box.

To change the button image,

choose Change Button Image, select a new image and close this dialog box.

Now, you’re ready to start

recording.

You’ll notice a small icon

on your screen, which signifies that you’re recording the macro.

Now, perform the actions you

wish to include in your macro. You can also pause and resume recording if

you want.

The Macro recorder doesn’t

record mouse movements. So, while, you can use the mouse to click commands

and options; to select, copy, paste or move items you must use the keyboard.

To finish recording, click on

the Stop recording button.

Finally, check out your macro

by clicking the macro’s toolbar button or pressing its keyboard shortcut.

Advertisment