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

Microsoft Office Excel 2003 Programming Inside Out

                             An object can also contain references to other objects. An order might have a reference to a
                             customer, or a form might contain a button. For purposes of this discussion, these object
                             references may also be characterized as properties.
                             An object can also represent a collection of similar things. For example the Employees object
                             could contain a collection of individual Employee objects.

                             Tip  Adjectives Describe Nouns
                             You can think of objects as nouns and properties as adjectives, that is, the red flower or the
                             six-foot-tall person. This concept isn’t perfect because some attributes are relatively
                             specific, such as the truck with 55,230 miles, but this idea might be helpful as you begin
                             working with objects.
             Chapter 14
                    What Are Methods?

                             Methods are actions that are performed by the object. For example, a report object might
                             include a print method that sends the report to a printer. Another way of thinking about
                             methods is that methods describe the operations performed with the information contained
                             in the properties of the object.


                             Tip  Verbs Describe Actions
                             You can characterize methods as a verb that performs an operation or a task with the
                             properties in the object.



                    What Are Events?
                             Although not strictly a part of the object programming model, events are a useful tool that
                             allow an object to communicate information with the program that created the object.
                             Simply put, an event is a subroutine residing in the program that created the object that’s
                             called by the object, which is called from within the object.
                             An event is a useful technique that obviates the need for a program to constantly monitor an
                             object for changes. Instead, the object calls the event to inform the calling program of a
                             change in the object’s state.


                    Introducing Class Modules

                             Class modules are among the most important tools in a VBA programmer’s tool chest. A class
                             module allows you to create your own objects, which you can manipulate just like objects
                             already supplied with Microsoft Excel. And just like the objects available in Excel, a class
                             module can have properties, methods, and events.






                300
             Part 4:  Advanced VBA
   321   322   323   324   325   326   327   328   329   330   331