How to Write a Macro in MS Word

Basic steps for writing a macro in MS-Word. The same steps apply for other applications in MS-Office package.
SHARE

In order to write a Visual Basic program to run in MS-Office packages (like Word, Excel, PowerPoint, Access etc) you need an editor. Microsoft has provided you with one. To bring this editor to the fore take the following steps. Here I assume that you are working in MS-Word.

In Word 2007 and above, click on the Office button (round orb like button in top left corner) and then click on the Word Options button given at the bottom of the menu.

A dialog box will appear. Go to the Popular tab and select the “Show Developer tab in the Ribbon” checkbox. Click OK.

SEE ALSO: Our Compilation of MS-Word Tips and Trick

Now on the ribbon, you will see Developer tab. Go to this tab and you will see a button to launch Visual Basic Editor.
In the Editor, you can start a new module and write your code in there. Then save the module. Remember, VBA modules created in Word are saved as documents.

Once you have written and saved the module, you can run it by opening the saved document and going to the View tab on ribbon. Then go to Macros button and select View Macros. A list of macros associated with the document will appear and you can select and run the macro you desire.

Leave a Reply

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