MarkAndrews
Well-known Member
- Joined
- May 2, 2006
- Messages
- 1,970
- Office Version
- 2010
- Platform
- Windows
I have the following code in place (Workbook_BeforeClose)
However - It does not like the following line
' get the chart sheets
For Each cht In ThisWorkbook
There are 18 charts in this workbook - Any Idea's?
TIA
However - It does not like the following line
' get the chart sheets
For Each cht In ThisWorkbook
There are 18 charts in this workbook - Any Idea's?
TIA
Rich (BB code):
Sub PrintAllCharts()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim chob As ChartObject
Dim cht As Chart
Dim vbAns As Long
vbAns = MsgBox("Do you want to print all charts?", vbQuestion + vbYesNo)
If vbAns <> vbYes Then GoTo ExitSub
' get the chart sheets
For Each cht In ThisWorkbook
cht.PrintOut
' get any charts embedded in the chart sheet
For Each chob In cht.ChartObjects
chob.Chart.PrintOut
DoEvents
Next
Next
' now get all charts embedded on all worksheets
For Each ws In ThisWorkbook.Worksheets
For Each chob In ws.ChartObjects
chob.Chart.PrintOut
DoEvents
Next
Next
ExitSub:
Application.ScreenUpdating = True
End Sub