The Word Object Model

To accomplish a task in Word VBA, or to work with Word using Automation code from other applications, you use the Word object model, a hierarchy of related objects that represent almost all of the components of Word that you use in the interface. Word objects are used to retrieve information, create new items, and cause Word to perform actions. Figure 18-3 shows the top-level objects in the Word object model.

Part of the Word Object Model

Figure 18-3. Part of the Word Object Model

To open the object model diagram in Help, select the Programming Information book in the Help Contents tab, then the Getting Started with Microsoft Word Visual Basic subbook, and select the Understanding Objects, Properties and Methods Help topic. Near the end of this Help topic there is a Microsoft Word Objects hyperlink that opens to the Word object model diagram when clicked. When you have the diagram open in Help, you can click on its component objects to open related Help topics.

The Application Object

The Application object is the root object of the Word object model, and represents the entire application. There is one — and only one — Application object available for use in Word-hosted VBA. When you are working in Word VBA, the Application object is always available, and can be referenced simply as Application. When you are working with Word objects from VBA hosted by other applications, you need to explicitly ...

Get Word 2000 in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.