Microsoft Office Tutorials and References
In Depth Information
18.4.1 Create the UserForm
The steps to create the print utility are as follows: all the action takes place in the Print.xls
workbook, so open this workbook. When the changes are finished, you will need to save Print.xls
as Print.utl as well. If Print.utl is loaded, the only way to unload it is to unload the add-in
SRXUtils.xla (if it is loaded) and close the workbook SRXUtils.xls (if it is open).
18.4.1 Create the UserForm
Create the dialog shown in Figure 18-7 in the Print.xls workbook. Name the dialog
dlgPrintSheets and set its Caption property to "Print Sheets." Then change the
PrintSheets procedure to:
Public Sub PrintSheets()
dlgPrintSheets.Show
End Sub
The dlgPrintSheets dialog has two command buttons and one list box:
dlgPrintSheets.Show
18.4.1.1 List box
Place a list box on the form as in Figure 18-7 . Using the Properties window, set the properties
shown in Table 18-4 .
Table 18- . Nondefault Properties of the List Box 4
Property
Value
Name
lstSheets
TabIndex
0
MultiSelect
frmMultiSelectExtended
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.
18.4.1.2 Print button
Place a command button on the form as in Figure 18-7 . Using the Properties window, set the
properties shown in Table 18-5 .
 
Search JabSto ::




Custom Search