Please Note:
This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Writing a Macro from Scratch.

Writing a Macro from Scratch

Many of the tips used in WordTips rely upon macros in order to run. Some readers may not know how to enter a macro from scratch in Word. There are actually two ways you can create macros. First you can record a macro, which is appropriate when you want to record a series of steps you perform quite often. The second method of creating a macro, writing one from scratch, is much more powerful.

To create a macro from scratch, follow these steps:

Choose the Macro option from the Tools menu, then choose Macros from the resulting submenu. Word displays the Macros dialog box. (You can also display the Macros dialog box by simply pressing Alt+F8.)

In the Macros In box (at the bottom of the dialog box), select where you want your new macro stored. Select Normal.dot (Global Template) if you want your macro available in all documents; select a different template if you want the macro available only with the current document template. You can even assign a macro to a specific document.

In the Macro Name box, type a descriptive name you want assigned to the macro you are writing. Optionally, you can enter information in the Description box.

Click on Create. The VBA Editor is started and you can write your macro.

When you are through, close the macro window by selecting the Close and Return to Microsoft Word option from the File menu, or press Alt+Q.

WordTips is your source for cost-effective Microsoft Word training.
(Microsoft Word is the most popular word processing software in the world.)
This tip (109) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Writing a Macro from Scratch.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. Learn more about Allen...

MORE FROM ALLEN

Counting Commas in a Selection

If you have a range of cells in which you want to count all the commas, there are several ways you can derive the figure you ...

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (menu)

Debugging a Macro

Create a macro and you are faced with the (sometimes) challenge of debugging it. Here's how to make that task as simple as ...

Comments

If you would like to add an image to
your comment (not an avatar, but an image to help in making the point of your comment),
include the characters [{fig}] in your comment text. You’ll be prompted to upload
your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will
be reduced. Up to three images may be included in a comment. All images are subject to
review. Commenting privileges may be curtailed if inappropriate images are posted.

Source

(gif, jpeg or png only, 5MB maximum file size)

Source

(gif, jpeg or png only, 5MB maximum file size)

Source

(gif, jpeg or png only, 5MB maximum file size)

Notify me about new comments ONLY FOR THIS TIP

Notify me about new comments ANYWHERE ON THIS SITE

Hide my email address

What is 3 + 3?

2017-01-17 05:14:46

Ken Endacott

What you want to do could be done by Find & Replace which would be much easier to learn to drive than to learn to write macros.

2017-01-16 17:51:18

Bill Holder

Hate to bother you for I know you are a very busy person, but I am needing help.

I am trying to write a Macro that will do the following;Find the CHAPTERHighlight that word and move over 3 spacesThen make it to have a Heading 2Then do a ReturnThen Loop through the rest until all CHAPTER have been reformatted.

Can't seem to get to loop, I did once but it looped so many I had to use ALT-CTRL-DELTE to stop the program, Word.

Any help woud be greatly appreciated,Bill

2015-10-28 15:34:10

Arthur Filz

How do you write a macron in Microsoft Word to search for a file. I saw it done in Excel