I am using the following code to print all charts in Excel 2010 workbook. However, it does not print all charts. Some are either partial chart or blank pages. any ideas? (I copied and pasted this VBA)I have tried another VBA code as well and it was the same.
Option Explicit
Sub PrintCharts()
'-------------------------------------------------------------------
'---Script: PrintCharts---------------------------------------------
'---Created by: Ryan Wells (wellsr.com)-----------------------------
'---Date: 04/2015---------------------------------------------------
'---Description: Orients and Prints all charts in an Excel Workbook-
'-------------------------------------------------------------------
Application.ScreenUpdating = False
Dim ch As Object
Dim sh As Worksheet
Dim icount As Integer
icount = 0
'Print Chart Objects
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
For Each ch In sh.ChartObjects
If ch.Height < ch.Width Then
ch.Chart.PageSetup.Orientation = xlLandscape
Else
ch.Chart.PageSetup.Orientation = xlPortrait
End If
icount = icount + 1
ch.Chart.PrintOut
Next ch
Next sh
'Print Charts
For Each ch In ActiveWorkbook.Charts
icount = icount + 1
ch.PrintOut
Next ch
MsgBox "Printing " & icount & " charts from Workbook " _
& ActiveWorkbook.Name & ".", vbInformation, "Print Charts"
Application.ScreenUpdating = True
End Sub
Option Explicit
Sub PrintCharts()
'-------------------------------------------------------------------
'---Script: PrintCharts---------------------------------------------
'---Created by: Ryan Wells (wellsr.com)-----------------------------
'---Date: 04/2015---------------------------------------------------
'---Description: Orients and Prints all charts in an Excel Workbook-
'-------------------------------------------------------------------
Application.ScreenUpdating = False
Dim ch As Object
Dim sh As Worksheet
Dim icount As Integer
icount = 0
'Print Chart Objects
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
For Each ch In sh.ChartObjects
If ch.Height < ch.Width Then
ch.Chart.PageSetup.Orientation = xlLandscape
Else
ch.Chart.PageSetup.Orientation = xlPortrait
End If
icount = icount + 1
ch.Chart.PrintOut
Next ch
Next sh
'Print Charts
For Each ch In ActiveWorkbook.Charts
icount = icount + 1
ch.PrintOut
Next ch
MsgBox "Printing " & icount & " charts from Workbook " _
& ActiveWorkbook.Name & ".", vbInformation, "Print Charts"
Application.ScreenUpdating = True
End Sub