Chapter 9. Object Models
In this chapter:
Objects, Properties, and Methods
Collection Objects
Object Model Hierarchies
Object Model Syntax
Object Variables
In this chapter, I present a general overview of object models and the syntax used to manipulate them in code. After this, we can turn specifically to the Word object model.
As I have discussed, VBA is the programming language that underlies several important Windows applications, including Microsoft Word, Excel, Access, PowerPoint, and Visual Basic. Any application that uses VBA in this way is called a host application. I also discussed how each host application enhances VBA by providing an object model (perhaps more than one) to deal with the objects that are particular to that application.
Microsoft provides over a dozen different object models for its Office application suite and related products. These include object models for Word, Excel, Access, DAO (Data Access Objects), Outlook, PowerPoint, Binder, Graph, Forms, VBA, VB, ASP (Active Server Pages), and more. Of course, our interest in this book is with the Word object model, and I will devote the rest of the book to describing the major portions of this model. (I also discuss a portion of the Office object model in Chapter 21, Menus and Toolbars.)
Objects, Properties, and Methods
In the parlance of VBA programming, an object is something that is identified by its properties and its methods. For example, documents, templates, paragraphs, fonts, and borders are all examples ...
Get Writing Word Macros, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.