Reputation: 1911
I want to print all sheets to a single pdf file. an each sheet would be on the beginning of new page.
I've tried with:
Private Sub CommandButton9_Click()
ActiveWorkbook.Sheets.Select
With Selection
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"E:\tempo.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End With
End Sub
I've got a message :"Method 'Select' of object 'Sheets' failed."
Thanks!
Upvotes: 2
Views: 1559
Reputation: 6982
instead of activesheet.export...
Use activeworkbook.export...
Each sheet will display by how you have the print setup for each sheet set.
Or use Variables such as:
Sub Button1_Click()
Dim wb As Workbook, Fnm As String
Set wb = ThisWorkbook
Fnm = "C:\Users\Dave\Downloads\TestMe.pdf"
wb.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fnm
End Sub
Upvotes: 2