Embedded Chart Window Title?

K

Ken

I have 5 Tab sheets ... Each with 1 embedded chart ...
When I open a Chart Window ... Two of the embedded charts
are Titled "Chart 2" & Three are Titled "Chart 1" ...

I have a recorded Macro to Print_ALL_Charts ... Issue is:
Macro is calling for "Chart 1" & therefore stalls out when
it hits a chart titled "Chart 2" ...

I would like all Chart Titles to be "Chart 1" ... so Macro
won't fail ...

How do I accomplish this? ... Thanks ... Kha
 
J

Jon Peltier

Ken -

Forget the names of the charts. This macro ought to help.

Sub PrintAllCharts()
Dim WS as Worksheet
Dim CS as Chart
Dim ChtO as Chart Object
'' loop thru all worksheets
For Each WS in ActiveWorkbook.Worksheets
'' do all the embedded charts
For Each ChtO in WS.ChartObjects
ChtO.Chart.Printout
Next
Next
'' loop through all chart sheets
For Each CS in ActiveWorkbook.Charts
CS.Printout
'' chart sheets can have embedded charts too
For Each ChtO in CS.ChartObjects
ChtO.Chart.Printout
Next
Next
End Sub

- Jon
 
Top