Working with Microsoft Excel Objects
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The Microsoft Excel object model contains several dozen objects that you can manipulate through VBA code. Almost anything you can do with Excel from its user interface, you can do by manipulating its objects through VBA. In addition, you can do things through VBA that can't be done through the user interface.
When you use VBA to work with Excel objects, either from within Excel itself or from another Office application, you have access to every part of Excel. The objects you will work with include cells, ranges, sheets, workbooks, charts, and more. In other words, every element in Excel can be represented by an object that you can manipulate through VBA.
This section will explore those objects, methods, and properties you will use most often and give you some insight into how to work with Excel objects. There are four Excel objects you will work with more than any others: the Application object, the Workbook object, the Worksheet object, and the Range object. Understanding when and how to use these objects will go a long way toward helping you understand how to work with Excel objects through VBA.
This section discusses some of the more common methods and properties you will use when working with Excel objects, but by no means does it discuss all available properties, methods, or events.
Note You can view the entire Excel object model in the . You can also use the Object Browser and Microsoft Excel Visual Basic Reference Help to learn more about individual objects, properties, methods, and events. For more information about using VBA to work with an Office application's object model, see Chapter 4, "Understanding Office Objects and Object Models."