Page 133 - Microsoft Office Excel 2003 Programming Inside Out
P. 133

Part 3:  The Excel Object Model


                      Chapter 6


                    The Application Object




                             Introducing the Application Object . . . .  108


                             Visual Basic for Applications (VBA) uses objects to control Microsoft Excel. Whether you are
                             working with the Excel application (Application object), workbooks (Workbook object), or
                             individual cells (Cell object), you do everything by manipulating an object. All of the objects
                             either contain other objects or are part of a larger object. For example, the Workbook object
                             contains Worksheets objects, which in turn contain Cell objects.

                             When working with an object, either a property is being set or read, or the object is told
                             to perform an action, called a method. If you wanted to select a worksheet named
                             Sheet2 in the active workbook, you would use the Select method of the Worksheet object,
                             Worksheets(“Sheet2”).Select.
                             The object model (shown in Figure 6-1) is used to describe how each object within Excel
                             relates to other objects. When you view the object model, you can see how one object contains
                             other objects, which contain other objects, which can contain even more objects. An object
                             might even contain multiple objects of the same type. For example, a workbook can contain
                             multiple worksheets.





























                             Figure 6-1.  The Microsoft Office 2003 Excel Object Model is the repository of all knowledge
                             in Excel.
                                                                                                       107
   128   129   130   131   132   133   134   135   136   137   138