I have the following VBA code where it prints the sheets perfectly.
but when I want to add charts located at the same file and tab, VBA does not generate the charts but only the sheets.
Highlighted lines at the bottom are the part I added to the original code which was intended for printing the sheets to the PDF.
I need help
Sub PrintPDF2()
Dim saveDIR As String
On Error Resume Next
saveDIR = "M:\dept\SLNGNA\Gas LPM\Structuring\Daily Report\Daily PDF Files\New England Gas Fundamentals_"
Sheets("New England Balances").PageSetup.PrintArea = "$C$3:$AA$212"
Sheets("LDCs MA").PageSetup.PrintArea = "$B$2:$X$135"
Sheets(Array("New England Balances", "LDCs MA")).Select
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0)
.BottomMargin = Application.InchesToPoints(0)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 3
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=saveDIR & VBA.Format(Date, "MMDDYYYY") & ".pdf", _
Quality:=xlQualityStandard, OpenAfterPublish:=True
Sheets("New England Balances").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=saveDIR & VBA.Format(Date, "MMDDYYYY") & ".pdf", _
Quality:=xlQualityStandard, OpenAfterPublish:=True
End Sub
Bookmarks