The Excel object model

Many real-world objects can contain objects that are themselves objects. For example, the hardware of a computer system contains parts such as a monitor, speakers, keyboard, mouse, and so on. These are themselves objects - sometimes collections and individual - that have properties and methods associated with them. The same analogy can be made for example, when VBA for Excel interfaces with objects such as workbooks, cell ranges, cells, charts, and so on. An object model is a description of the object hierarchy. Excel/VBA contains a clearly defined set of objects that are arranged according to relationships between them. Figure 4.1 shows a portion of the Excel object model. This is not complete but should give you an idea of the relationships between Excel objects. As we can see from Figure 4.1, the Application object is at the top level. Contained within the Application object are the Workbooks collection and all the Workbook instances within this; at the next lower level, we have the Worksheets collection along with the instances of each Worksheet in the collection. Next, we have the Range object, which does not have a plural collection.

Vba Excel Objektmodell
Figure 4.1 The hierarchy of some Excel objects
0 0

Post a comment