|
|
Advertisement |
 |
PPC
> Computing
Guides > Windows
Automating repetitive tasks
Kai Chandler looks at macros.
Part One – Microsoft Word.
Computers are supposed to make things easier
aren’t they? Then why not let them do the legwork of automating
repetitive tasks?
Part One of this two-part series looks at the Macro
function of Microsoft Word. Part Two introduces a low cost shareware
program to provide a similar function anywhere in Windows.
What is a macro?
Imagine a recording of a set of commands that you can save
and apply whenever you need it. A macro remembers the sequence of
keystrokes or mouse clicks to perform a task so you can play it back
again and again.
Here’s a typical task for a Word macro. I’m
using Word 2000 but the principle is similar for other versions of
Word. The challenge is to create a macro to resize a set of pictures
in Word so they are all 3 cm wide.
The steps are the same whatever your repetitive task.
To record the macro:
1.
Select Macro from the Tools menu then select Record to record your
new macro.
2.
Give it a name – preferably something meaningful such as
‘Imageresizer’ and press Enter. Note that the macro name must
not contain spaces.
You
are now recording any keystrokes and mouse movements. A floating
window allows you to Stop or Pause the Macro recording as required.
3. Press the Stop button or select Tools, Macro,
Stop Recording when you are finished.
To use the macro:
-
1. Select the image that needs to be resized,
-
2. Press Alt-F8 (this is the same as selecting
Tools | Macro | Macros)
-
3. Select the Macro you want to run – in this
case, Imageresizer
-
4. Select Run
and if all has worked, your image will be resized.
Repeat for other images.
Your macro is stored in your default Word template
so will be available whenever you need it.
To make it even easier to call your macro, you can
give it a keyboard shortcut. This is done when defining the macro
– just select the keyboard icon and tell Word what shortcut you
wish to use, for example alt-shift-y.
If
you are feeling adventurous you can view the underlying program by
selecting Edit from Macros window. Your macro is stored in a
language called Visual Basic. There’s a lot more information about
Macros and Visual Basic in the Help menu.
If you want to experiment with macros you should
remember that planning is essential. Be sure of what you want to
achieve and how to do it cleanly because any mistakes will also be
recorded. You can edit the macro later to remove unnecessary steps
but it’s easier to get it right first time.
The really good news is that you can define Macros
in exactly the same way in most Microsoft Office products, including
Excel and Frontpage so your knowledge is reusable, just like your
macro.
Just be
warned of one thing, many internet users have macros turned off to
prevent infection by macro viruses so if you create a macro for
someone else to use, it’s only polite to warn them that your
document contains macros and they are not about to be infected by
the latest virus!
|