A metaphor for objects and collections
The basic unit of Excel is the workbook object; In fast food chains, the basic unit is a single restaurant. Using Excel, you can add workbooks and close workbooks, and all open workbooks make up the Workbooks collection (a collection of Workbook objects). The operators of fast food chains can add restaurants and close restaurants, and can treat all restaurants in the chain as a "restaurant" collection (a "Restaurant" object).
An Excel workbook is an object, but it also contains other objects, such as sheet objects, chart objects, VBA modules, and so on. Also, each object in the workbook can contain its own objects, for example, a Worksheet object can contain a Range object, a PivotTable object, a Shape object, and so on.
A restaurant (like a workbook) is an object that contains other objects, such as the kitchen object, the dining room object, the Table object, and so on. All of the individual objects make up their own collections, for example, all tables in a restaurant make up a "table" collection. The operator can add or remove objects from the "Restaurant" object, for example, the operator can add more tables to the "dining table" set. Also, each object in a restaurant can contain other objects, for example, the "Kitchen" object contains "stove" objects, "exhaust fan" objects, "Chef" objects, "pool" objects, and so on.
A metaphor for the properties and methods of an object
Excel objects have properties. For example, the Range object includes the Value property and the Name property, and the Shape object includes the Width property and the Height property. With this analogy, the objects in the chain store also have attributes. For example, the Stove object contains properties such as temperature and number of stoves. The "Exhaust fan" object also has its own set of properties (such as "steering", "rpm per minute", etc.).
In addition to attributes, Excel objects have methods that use methods to perform an action on an object. For example, the ClearContents method clears the contents of a Range object. The objects in the chain store also have methods that can be easily imagined to provide a "thermostat" method for the "Stove" object, or to provide an "on/off" method for the "exhaust fan" object.
When using Excel, methods sometimes change the properties of an object. The ClearContents method can change the Value property of a Range object. Similarly, the thermostat method on the Stove object will affect its temperature property.
You can use VBA to write procedures to work with Excel objects. In a chain store, the operator can order the objects in the restaurant (for example, open the stove and open the exhaust fan to the fastest).
VBA object Model (1)