Written by Allen Wyatt (last updated October 20, 2018)
This tip applies to Word 97, 2000, 2002, and 2003
As you may be aware, Word is an object-oriented program. Internally, Word keeps track of "objects" in your document, such as paragraphs, styles, sections, etc. These objects can be grouped together in collections, which represent all the related objects of a particular type. For instance, the Paragraphs collection represents all the individual Paragraph objects within a document.
As you are creating macros in VBA, it is a good idea to understand the object model used by Word. This model defines all the objects understood by the program (and to which you have access), as well as the various properties (attributes) and methods (procedures) associated with those objects.
If you want to understand more about Word's object model, there are a few different places you can look. The first is the VBA Help system provided with Word. Unfortunately, the VBA Help file is not automatically installed when you install Word or Office. If you cannot access Help while in the VBA Editor, you will need to again run the Word or Office Setup program and make sure the VBA Help file is installed. When you open the VBA Help file, go the Contents tab, expand "Programming Information," expand "Microsoft Word Visual Basic Reference," click on "Microsoft Word Objects," then click on "Documents." You can also search for the term "Object Model" for the information you need.
You can also find out about the object model through the MSDN Web site. Visit the following Web page:
There are a number of Word developer-oriented books available on the market. Other WordTips subscribers speak well of VBA Developer's Handbook by Ken Getz and Mike Gilbert (Sybex Books, ISBN 0782119514) and Microsoft Office 2000 Visual Basic Programmer's Guide by David Shank, Mark Roberts, and Tamra Myers (Microsoft Press, ISBN 1572319526).
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1622) applies to Microsoft Word 97, 2000, 2002, and 2003.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
When creating macros, you often need to convert a text string that contains numbers into actual numeric values. You do ...Discover More
Want to grab some interactive input from a user in your macro? The best way to do that is with the InputBox function, ...Discover More
Wouldn't it be great if Word could execute a macro every time someone typed in a particular keyword or phrase? Word may ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.
Visit the WordTips channel on YouTube