OK. I made the change. I get Compile error : Sub or Function not defined and highlight in blue ExportAsFixedFormat....
At the same time, can I change the code to make allow the user to browse to the folder where he / she would like the document saved?
- Sub PrintToPDF()
- Dim a As Long, i As Long, j As Long, pbArr
- ActiveSheet.PageSetup.PrintArea = Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row).Resize(, 9).Address
- a = ActiveSheet.PageSetup.Pages.Count
- ReDim pbArr(1 To a - 1)
- For i = 1 To a - 1
- pbArr(i) = ActiveSheet.HPageBreaks(i).Location.Row
- Next i
- With ActiveSheet
- ExportAsFixedFormat xlTypePDF, ThisWorkbook.Path & "\" & "Temp Junk " & "ABC" & ".pdf"
- End With
- For j = LBound(pbArr) To UBound(pbArr)
- ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Cells(pbArr(j), 1)
- Next j
- End Sub