An Introduction To The Excel Object Model

Vertex42 The Excel Nexus

Professional Excel Templates

Get Instant Access

Designed around the ability to access and manipulate objects, VBA has access to an Object Model in each Microsoft Office product, including Excel, that enables you to interact with each application. Using the Object Model, you can access everything from the entire application to an individual cell in a worksheet.

Objects represent the individual pieces of each application. Every object has specific properties and methods associated with it. You use properties and methods to capture events and changes that occur with the selected object.

With such an enormous number of objects, properties, and methods, you may find remembering them all is virtually impossible. Luckily, the Visual Basic Editor provides the Object Browser, with which you can quickly locate and determine the corresponding properties and methods available for an object. You can learn how to use the Object Browser by performing the tasks in this chapter.


The Excel Object Model provides nearly 200 different objects and more than 5,000 corresponding properties and methods for use in your VBA code. Each object represents an element of the Excel application. For example, the Application object refers to the entire Excel application, but a Worksheet object refers to an individual worksheet.

Most objects have child objects. A child object is an object that is part of a larger object. For example, a Worksheet object is a child object to a Workbook object because worksheets are part of a workbook. All objects in the Excel Object Model are the children of at least one other object, except the Application object. All objects are under the Application object either as children or children of another Application object. Because of this hierarchy within the Object

Model, you typically need to reference the parent object with a child object. For example, to access the second worksheet in the current workbook you type ThisWorkbook.Worksheets(2).

The Object Model groups common objects into collections. For example, the Workbook object identifies an individual workbook, but the Workbooks collection refers to all open workbooks.

Although the list of available objects is rather extensive, you use only about six frequently: Application, Workbook, Worksheet, Chart, Range, and Dialog. Because you use these objects extensively when you work with Excel Macros, it is a good idea to familiarize yourself with these objects, which the remainder of this book covers.

Was this article helpful?

0 -1

Post a comment