Create the UserForm Obq

Create the dialog shown in Figure 20-45 in the Print.xls workbook. Name the dialog dlgPrintPivotTables, change its Caption property to "Print Pivot Tables," and change the PrintPivotTables procedure as shown in Example 20-5.

Example 20-5. The PrintPivotTables Procedure

Public Sub PrintPivotTables()

dlgPrintPivotTables.Show End Sub

The dlgPrintPivotTables dialog has two command buttons and one list box. 20.12.1.1 List box

Place a list box on the form as in Figure 20-45. Using the Properties window, set the following properties:

Property

Value

Name

lstPTs

Tablndex

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.

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

0 0

Post a comment

  • Receive news updates via email from this site