Читать книгу Excel VBA Programming For Dummies - Dick Kusleika - Страница 70

Understanding the object hierarchy

Оглавление

The Application object is at the very top of the hierarchy in the object model. It represents Excel itself and every other object is a child or grandchild of the Application object. The following are some of the more useful objects contained just below Application in the hierarchy:

 Addin

 Window

 Workbook

 WorksheetFunction

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

 Chart (which is a chart sheet)

 Name

 VBProject

 Window

 Worksheet

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

 Comment

 Hyperlink

 Name

 PageSetup

 PivotTable

 Range

If you want to do something with a range on a particular worksheet, you might find it helpful to visualize that range in the following manner:

Range ⇒ contained in Worksheet ⇒ contained in Workbook ⇒ contained in Excel

Excel has more objects than you can shake a stick at. Even power users would get overwhelmed if they tried to learn every object in the object model. The good news is that you don’t have to do anything with most of these objects. You could go your whole VBA programming life and never need to use the Excel4MacroSheet object. You only need to know the objects for the problem your working on and most of the time the macro recorder tells you everything you need.

Excel VBA Programming For Dummies

Подняться наверх