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

Microsoft Office Excel 2003 Programming Inside Out

                             Windows Explorer. The root object, or base object of the tree, is the current workbook that
                             you are working in, along with any other workbooks and Add-Ins that might be open.
                             The main elements utilized by VBA projects are each stored in a separate folder within the
                             project. Those elements include objects, which were introduced in Chapter 3; modules,
                             which contain the macro code associated with a worksheet; class modules, which are defini­
                             tions of user-defined objects you’ve created for your workbook (described in more detail in
                             Chapter 14); and user forms, which are described in Chapter 19.

                             In the example shown in Figure 4-1, the current workbook is identified as VBAProject
                             (DateTimeManipulations.xls). The three worksheets included in the workbook (Sheet1,
                             Sheet2, Sheet3), along with the entire workbook (ThisWorkbook), are inside the Microsoft
                             Office Excel Objects folder. Any macros programmed in VBA or recorded also appear in the
                             Modules folder. Any class modules or user forms would appear in a Class Modules or a
                             Forms folder, respectively.




















             Chapter 4







                             Figure 4-1.  The Visual Basic Editor organizes your programming elements to make them
                             easier to manage.

                             Directly below the Project Explorer window is the Properties window, which is used to exam­
                             ine and change the various properties associated with the selected object. For modules and
                             worksheets, usually the Name property is the only one available, although worksheets do
                             have additional properties that can be changed. Working with properties is most often done
                             when working with user forms.







                42
             Part 2:  Visual Basic for Applications
   63   64   65   66   67   68   69   70   71   72   73