I was using .ExportAsFixedFormat from this topic, but unfortunately, Printed PDF had some issues about formatting and some symbols.
I've tried CutePDF Writer and it is OK.
Now, I want to select all sheets and to print as a single file, as the same with .ExportAsFixedFormat function
Is there any shortcut to select all sheets and to print them through VBA to PDF?
I've tried to insert an array, which I populated with sheet names. But I have an error with type mismatch.
Private Sub CommandButton9_Click()
Dim SNarray, i
Dim Filename As String
Filename = "E:\TestMe1.pdf"
ReDim SNarray(1 To Sheets.Count)
For i = 1 To Sheets.Count
SNarray(i) = ThisWorkbook.Sheets(i).name
Debug.Print SNarray(i)
Next
Application.ActivePrinter = "CutePDF Writer on CPW2:"
Sheets(SNarray()).Select 'Here is the TYPE MISMATCH
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:="CutePDF Writer on CPW2:", PrintToFile:=True, Collate:=True, prtofilename:=Filename
End Sub
Thanks!
Dim SNarray() as String. BTW, nice to see that we can select the printer, I've never done that but that may come in handy! :) - R3uK