Climbing the Object Hierarchy

The Application object contains other objects. Following is a list of some of the more useful objects contained in the Excel Application:

I Addin I CommandBar i Window I Workbook i WorksheetFunction

Each object contained in the Application object can contain other objects. For example, the following is a list of objects that can be contained in a Workbook object:











In turn, each of these objects can contain still other objects. Consider a Worksheet object (which is contained in a Workbook object, which is contained in the Application object). Some of the objects that can be contained in a Worksheet object follow:

^ Comment ^ Hyperlink i Name i Outline i PageSetup i PivotTable i Range

Put another way, if you want to do something with a range on a particular worksheet, you may find it helpful to visualize that range in the following manner:

RangeOcontained in WorksheetOcontained in Workbooks contained in Excel

Is this beginning to make sense?

Before you come down with a bad case of object overload, it's important to understand that you never need to use most of the objects available to you. In fact, most VBA work involves only a few objects. Even better, you can almost always find the relevant object by recording a macro while doing something with that object.

0 0

Post a comment