Microsoft Office Tutorials and References
In Depth Information
20.12 Example: Printing Pivot Tables
20.12 Example: Printing Pivot Tables
Now we can implement the PrintPivotTables feature of the SRXUtils application. A complex
Excel workbook may have a large number of pivot tables scattered on various worksheets. A
simple utility for printing these pivot tables can be useful. (I have often been asked to write such a
utility in my consulting practice.)
Our application displays a dialog box, as shown in Figure 20-45 . The list box contains a list of all
pivot tables. Each entry includes the pivot table's name, followed by the name of the worksheet.
The user can select one or more pivot tables and hit the print button to print these tables.
Figure 20-45. Print pivot tables
The following are the steps to create the print utility. 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).
20.12.1 Create the UserForm
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()
End Sub
The dlgPrintPivotTables dialog has two command buttons and one list box. List box
Place a list box on the form as in Figure 20-45 . Using the Properties window, set the following
Search JabSto ::

Custom Search