Microsoft Office Tutorials and References
In Depth Information
Figure 3-7. The Object box
Figure 3-7. The Object box
Figure 3-8 shows the contents of the Procedure box when the cmdClose object is selected in the
Object box. This list contains the names of the 13 different events that are associated with a
command button.
Figure 3-8. The Procedure box
For example, if we select Click, we will be placed within the Code window between the following
two lines, where we can write event code for the Click event of the cmdClose command button :
Private Sub cmdClose_Click()
End Sub
3.4 The Immediate Window
The Immediate window (see Figure 3-1 ) has two main functions. First, we can send output to this
window using the command Debug.Print . For instance, the following code will print whatever
text is currently in cell A1 of the active worksheet to the Immediate window:
Debug.Print ActiveSheet.Range("A1").Text
This provides a nice way to experiment with different code snippets.
The other main function of the Immediate window is to execute commands. For instance, by
selecting some text in the active document, switching to the Immediate window, and entering the
line shown in Figure 3-9 , the selected text will be boldfaced (after hitting the Enter key to execute
the code).
Search JabSto ::

Custom Search