Example Printing Embedded Charts

We can now implement the PrintCharts feature of our SRXUtils application. This is designed to provide a list of the embedded charts in the active workbook, so the user can select from this list and print the selected charts. (To print a chart sheet, use the PrintSheets utility.)

Implementing the PrintCharts utility is similar to implementing the PrintSheets and PrintPivotTables utilities, which we did earlier in the book. At the present time, this print utility, located in the Print.utl add-in, simply displays a message box. To implement this feature, we want the utility to first display a dialog box, as shown in Figure 21-32.

Figure 21-32. Print Charts dialog

Figure 21-32. Print Charts dialog

The list box contains a list of all embedded charts in the active workbook. The user can select one or more charts and hit the Print button.

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 SRXUlils.xla (if it is loaded) and close the workbook SRXUtils.xls (if it is open).

0 0

Responses

  • angelico
    How to print charts in vba?
    6 years ago

Post a comment