Example Code for the Printing Procedures

Public Sub PrintCharts()

MsgBox "This is the print charts utility" End Sub

Public Sub PrintPivotTables()

MsgBox "This is the print pivot tables utility" End Sub

Public Sub PrintSheets()

MsgBox "This is the print sheets utility" End Sub

Now, the Print.xls workbook is an ordinary Excel workbook, so if our add-in opens this workbook in order to call one of its procedures, the workbook will be visible to the user. This is not good. Hence, we need to create an add-in from this worksheet as well. Let us call it Print.utl. (You can save the worksheet under this name by placing the name in quotation marks in the File name box in Excel's Save As dialog. If you omit the quotation marks, Excel will save the file as Print.utl.xla.) Don't forget to perform the usual add-in creation rituals for this workbook (compile the code, set the workbook and project properties, and lock the workbook from viewing) before saving it as an add-in.

We now need to implement the RunUtility procedure. This procedure, which should be placed in the basMain code module, is shown in Example 12-14.

0 0

Post a comment