GeneralWriting software

Tools for writers: Macros in Microsoft Word–a basic how to

From Rick:

What are they? Some of you have no doubt heard about “macros” and either had no clue or figured they were something too techie for you. Put simply, a macro is nothing more than a group of keystrokes than can be executed with s single keystroke or by running the macro.

First, let’s give an example. Let’s say that you often use a particular expression, word, or character name that’s either awkward to type or easy to mistype. We’ll use the simple example of the word résumé with its two accented e’s. You’re writing a piece about résumés and you keep getting slowed down by having to type it.

There are two ways to do it. One way is to type some sequence such as “xxx” instead then search and replace it later. That would work, and it’s probably easier than creating a macro. But keep in mind that a macro can include as many keystrokes as necessary, even things such as backspaces, symbols, arrow keys, etc. In fact, macros can be quite complex. You could, for example, create ONE macro to perform a whole series of search and replace operations on your manuscripts.

So, let’s show you how to create one. In Word’s menus go into VIEW and MACROS. In the newer versions of Word, on the far right of the View ribbon, you’ll see MACROS. Click the small arrow under “Macros” to see the View and Record options.

Before you record, you should write down the keystrokes you need to use. There is no rush to enter your keystrokes during the recording. It doesn’t matter how fast or slow you click them. They’ll record just fine. For our word résumé, we will be entering the following sequence:

r (ctrl)’ e s u m (ctrl)’ e
(ctrl) means to hold down that key them press the apostrophe at the same time. Try that first and you’ll see the é appear in your line of typing.

You’re now ready to record your first macro. Go to the Macros and select RECORD MACRO. This puts you into the record mode. But first you’re going to see a dialog box with four options.

–MACRO NAME: You can name the macro whatever you want. A default name will appear, but you can and should change it to something meaningful.

–ASSIGN MACRO TO: Here is where you can assign it to a keyboard shortcut with some combination of SHIFT CTRL ALT and another key. Keep in mind that many shortcuts are already assigned to something. Fortunately, the dialog box will let you know if the shortcut you choose is already in use. You have the option of replacing it with your new macro, but careful that you don’t assign it to a useful shortcut. For example, if you assign it to ALT U (the underline shortcut), you’ll lose that function in Word until you delete the macro, which will restore that function.

For purposes of this exercise, let use CTRL ALT U as our shortcut. To do that hold the CTRL and ALT keys down while you press U. Then release. Click the ASSIGN button then CLOSE.

You’re now in RECORD MODE. From this point on you must now enter any keystrokes other than the ones you intend for the macro. Once you’re finished, move your mouse up to MACROS, click the arrow, and select STOP RECORDING. (Note that you have the option to PAUSE RECORDING if necessary, and none of your keystrokes will record until you unpause it.)

For practice, let’s actually do the résumé macro by entering the keystrokes I listed above and which I’ve repeated here:

r (ctrl)’ e s u m (ctrl)’ e

STOP RECORDING when done. Now, if you hold CTRL ALT and press U, you should see the word “résumé” typed out. After you’re done playing, if you don’t want to keep the macro, go up to VIEW, MACROS and select the “View macros” option. You’ll see a list of any macros you’ve created (probably just this one now). Highlight it and click the DELETE option in the box.

I do want to point out that setting up a keyboard shortcut is not the only way to run a macro. When you’re in the View Macros menu you’ll see an option to RUN a macro. By selecting the macro and choosing RUN, you can activate it. However, one caution: The macro will run immediately, and if the macro is supposed to enter keystrokes into the document (as the one we just created is), the word “résumé will be entered wherever your cursor is positioned. Therefore, it’s often a good decision to use a keyboard shortcut because then you’re probably looking at where your cursor is when you activate the macro.

When you close Word, you may see a message about changes to the Normal.dotm template. Be sure you say YES to this to retain the macro. Otherwise, it won’t be there when you open Word again.

NOTE: Saving changes to the NORMAL.DOTM template (particularly when you don’t realize you’re doing it) can be another Word annoyance that I’ll talk about in a moment. So, have fun with macros. Again, you can make a macro to do anything that you can accomplish with your keyboard and mouse. Yes, it’s not limited to keystrokes. ANY Word option that you can click on with your mouse can be recorded as a macro, including such things as making Word highlight every instance of “was” in your document. That’s tricky and requires some planning, but as I said, anything you can do manually, you can record in a macro to activate with a simple shortcut.

But this instruction wasn’t designed to teach you everything about macros, just to give you some options–as a writer–for making your life easier. As another more practical example, let’s say you’re writing a novel and would like to program a macro with your standard chapter heading. When I do a new chapter, I typically space down 5 double lines, center the word “Chapter” followed by the chapter number, then 4 more lines before I begin the chapter itself. It would be a simple matter to create a macro (even to have it add a page break at the end of the previous chapter. All you’d have to do is manually enter the actual chapter number instead of NN or XX that you could program into the macro. That not only saves you time, but ensure you use the same format each time.

I referred to the NORMAL.DOTM template above. Briefly, this template is Word’s default setup for any new document. It includes your font and margin settings, plus a few other things, including your macros (unless they’ve been saved elsewhere). The annoyance comes in whenever something changes your default settings. Word (by default) simply accepts the changes and never tells you that it’s saved new ones. The next time you open a document and expect, say Times New Roman for your default font, you might get something else.

To avoid surprises, Word lets you choose it have it prompt you when changes occur. So, if you close Word, see the message, and know you haven’t changed anything intentionally, you can say “no” and keep what you had set before.

So, where do you pick this prompting option? In Word 2007 and 2010, it’s under the ADVANCED WORD OPTIONS (in 2007, click the MS OFFICE symbol in the top left of your window, and select the WORD OPTIONS button. Click ADVANCED on the left and scroll down to SAVE. Under the SAVE options, you’ll see something like “Prompt before saving Normal template.” Be sure you check it if it isn’t. Now, when you close Word, you’ll see the prompt if any changes have occurred. If you’ve just created a macro, you will see the prompt.

I hope this post has been instructive and that perhaps some of you will want to try to create a macro or two. Note that this is only a very simple lesson on macros. They are very powerful and can become quite complex, but I hope this instruction will benefit some of you.

–Rick

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.