Microsoft Office Tutorials and References
In Depth Information A workbook or sheet object A workbook or sheet object
When a workbook or sheet object is selected in the Project window, the Object box contains only
two entries: general, for general procedures, and the object in question, either Workbook ,
Worksheet , or Chart . When the object entry is selected, the Procedure box contains empty code
shells for the events that are relevant to that object. Figure 3-5 shows an example.
Figure 3-5. The events for a workbook object
If, for example, we choose the BeforeClose event in the Procedures box, Excel will create the
following code shell for this event and place the cursor within this procedure:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
End Sub A standard module
When a standard module is selected in the Project window, the Object box contains only the entry
General, and a Procedure box lists all of the procedures we have written for that module (if any).
Figure 3-6 shows the open Procedure box, with a list of the current procedures for a particular
module. The Declarations section is where we place variable declarations for module-level
variables —that is, for variables that we want to be available in every procedure within the
module. We will discuss this in detail in Chapter 5 .
Figure 3-6. The Procedure box A UserForm object
When a UserForm object is selected in the Project Explorer, the Object box contains a list of all of
the objects contained in the UserForm. For instance, Figure 3-7 s hows the contents of the Object
box for the UserForm object in Figure 3-3 . Note that there are entries for the various command
buttons (such as cmdClose ), the various other controls, and even for the UserForm itself.
Search JabSto ::

Custom Search