Page 56 - Excel Progamming Weekend Crash Course
P. 56
d540629 ch03.qxd 9/2/03 9:27 AM Page 31
SESSION
3
The Excel Object Model
Session Checklist
✔ Using properties and methods
✔ Working with collections
✔ The object hierarchy
✔ The Workbook object
✔ The Worksheet object
he Excel object model is one of the two pillars of Excel programming (the other being
the VBA language). As you saw in Session 1, the Excel application is made up of objects
T that provide the program’s functionality. Because these objects are “exposed” — that is,
available to manipulation from the outside — they can be controlled by VBA code to create
custom programs. The collection of objects exposed by Excel is called the Excel object
model, and this session gives you an overview of the model and some of its most fundamen-
tal components.
Understanding Properties and Methods
When discussing objects, it is essential to have an understanding of object properties and
methods, collectively called members. In one sense an object is its properties and methods
because these are the only aspects of an object that are exposed to the outside world (that
is, to your program). When you use an object, you are working with its properties and
methods.
A property is a piece of information that is associated with an object. A property might
provide some information about the object or specify some aspect of the object’s appearance
(for objects that have a display component) or behavior. Using a car as an example, its
properties would include its color, the station to which the radio is set, and the amount of