Creating an add-on for Microsoft Word is a great way to personalize your word processing application. Microsoft Office comes with a built-in add-on editor, in older versions it is called Visual Basic for Applications or VBA; in Office 2007 and later versions, it is called Visual Studio Tools for Applications, or VSTA.
Users can use the editors to create add-ons that are universal and can be used in Word, Access, Excel or they can create specific add-ons that will only be used in one Office application, such as Word.
Among other things, users can make Word add-ons that automatically add letterheads or watermarks to documents, create buttons or new toolbars or install add-ins for specific documents like login or informational pop-up boxes.
Creating a Word Add-On in VBA
In this tutorial, we’ll make a pop-up box that will open automatically when a Word document is opened and direct the user to the file where the Word documents are stored. This add-on would be useful for projects that have multiple users as an aid to remind everyone where the project files are stored.
Open Office Word and create a new document.
Click Tools > Macros > Visual Basic Editor.
Under Insert on the toolbar in the VBA Editor, click Module.
Script is used to create add-ons in the VBA editor. The amount and length of the script used varies depending on the type of add-on that is being created. This is a relatively simple add-on, so the script used here is minimal. In the module type in:
Public Sub AutoExec()
MsgBox ("The Project Files are located in the Project A Folder " _
& vbCrLf & Word.Application.StartupPath)
Press the F5 key to bring the new message box up. Press Run in the Auto Exec pop-up box.
Press OK when the message box pops up in the document.
Close the VBA Editor and give the document a name by opening the Save As… option under File.
Save the document as a template in the Word Start Up folder. Word will automatically try to save it in the Template folder, so use the Save pull-done menu to back out of the Template folder and follow the path: Microsoft > Word > Start Up.
By saving it in the Word Start Up folder, the pop-up box will open every time a word document is opened from that shared folder. In order to get rid of the pop-up box, simply go into the Start-Up folder and delete the template.
This tutorial is a simple one and was created in order to give users a quick glimpse on how to create an add-on from scratch. A good place to get more information regarding creating Office add-ons is from Microsoft’s VBA or VSTA websites.
For more tutorials and tricks, browse through the collection of Microsoft Word user guides found here at Bright Hub. Learn how to create a macro, find tips for customizing Word’s default options, get design ideas for making your own templates, and more. Additional guides are being added all the time, so check back often.