Microsoft Office Tutorials and References
In Depth Information
20.12.1.2 Print button
When the Cancel property of the cmdCancel button is set to True , the button is "clicked" when
the user hits the Escape key. Thus, the Escape key will dismiss the print dialog.
The MultiSelect property is set to frmMultiSelectExtended so that the user can use the
Control key to select multiple (possibly nonconsecutive) entries and the Shift key to select
multiple consecutive entries.
The TabIndex property determines not only the order in which the controls are visited as the user
hits the Tab key, but also determines which control has the initial focus. Since we want the initial
focus to be on the list box, we set its tab index to 0.
20.12.1.2 Print button
Place a command button on the form as in Figure 20-45 . Using the Properties window, set the
following properties:
Property
Value
Name
cmdPrint
Accelerator
P
Caption
Print
TabIndex
1
20.12.1.3 Cancel button
Place another command button on the form as in Figure 20-45 . Using the Properties window, set
the following properties:
Property
Value
Name
cmdCancel
Accelerator
C
Caption
Cancel
TabIndex
2
Cancel
True
20.12.2 Create the Code Behind the UserForm
Now it is time to create the code behind these controls.
20.12.2.1 The Declarations section
The Declarations section should contain declarations of the module-level variables as shown in
Example 20-6 .
Example 20-6. Module-Level Variables in the user form's Declarations Section
Dim cPTs As Integer
Dim sPTNames() As String
Dim sSheets() As String
20.12.2.2 Cancel button code
The Cancel button code is shown in Example 20-7 .
 
Search JabSto ::




Custom Search