Forum Discussion
Continuous printing with Macros possible?
Is it possible to print multiple pages without stoping for each page? I have a print command that prints three different sheets in PDF, but stops at the beginning of each sheet and requires me to save that corresponding sheet as a different name. I would like it just to print one continuous report. This is my coding.
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Sheets("Workup 1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Sheets("PO List").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
End Sub
9 Replies
- Haytham AmairahSilver Contributor
Hi,
If you just want to save each sheet of them as PDF, you can use this code instead:
Sub Macro1() 'In the below line type the full path of the location you want to save in ChDir "C:\Users\<UserName>\Desktop" ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ ActiveSheet.Name, Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Sheets("Workup 1").Select ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ ActiveSheet.Name, Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Sheets("PO List").Select ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ ActiveSheet.Name, Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False End Sub
If you want to run the command on all sheets in the workbook, you can encapsulate it in a For-Each-Loop as follows:
Sub Macro1() ChDir "C:\Users\<UserName>\Desktop" For Each Sheet In Sheets Sheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ Sheet.Name, Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Next Sheet End Sub
Hope that helps
- Budman36Brass Contributor
Thank you for the response.
The first code you suggest would let me save them as 3 different documents (PDF)? If so, that's what my current code does. I am looking to have it print/save PDF as one continuous form as if it was all one page. That would be your second code? I am confused on how you explained you options.
- Haytham AmairahSilver Contributor
If you want to save all worksheets in the workbook in one continuous PDF, try this code instead:
Sub Macro2() ChDir "C:\Users\<UserName>\Desktop" ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ ThisWorkbook.Name, Quality:= _ xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=False End Sub
Regards