Microsoft Office Tutorials and References
In Depth Information
Printing All Embedded Charts
To delete a specific Chart sheet, use a statement like this:
ActiveWorkbook.Charts(“Chart 1”).Delete
To delete all Chart sheets in the active workbook, use the Delete method of the
Charts collection:
When this statement is executed, you’ll see the alert message displayed in
Figure 16-4. To eliminate this message, set the DisplayAlerts property to False.
Normally, you’ll want to set this property back to True after the sheets are deleted.
The following procedure demonstrates.
Sub DeleteAllChartSheets()
Application.DisplayAlerts = False
Application.DisplayAlerts = True
End Sub
Figure 16-4: This message, which appears when a sheet is about to be deleted,
can be avoided by setting the DisplayAlerts property to False.
Printing All Embedded Charts
As you know, printing a worksheet also prints the embedded charts on that
worksheet. In some cases, you may prefer that each chart be printed on a separate page.
The example in this section prints all embedded charts on the active sheet.
Sub PrintAllCharts()
Dim ChtObj As ChartObject
For Each ChtObj In ActiveSheet.ChartObjects
Next ChtObj
End Sub
This procedure loops through all ChartObject objects and uses the PrintOut
method of the Chart object. If you would like to preview the charts, use the
PrintPreview method instead of the PrintOut method.
Search JabSto ::

Custom Search