Does not print multiple Excel Sheets

2006-07-18 18:15:51 by jimb

When selecting two or more worksheets in MS Excel PDF Creator only creates PDF with the printed output of the first sheet and omits the other sheets in the pdf file.

Any thoughts.

jimb


2006-09-13 12:26:19 by ulric

Multiple woorksheets with different resolution always are printed by multiple print jobs and generate multiple pdf files. Make sure that in Excel all selected woorksheets have the same resolution.

See Microsoft Support...

Simone


2008-11-20 22:02:45 by jsemmanuel

I am having the same problem. Only a single sheet gets printed. Can you please help quickly since the rest of the code is working ok. I really needed to print 4 sheets to a single pdf and then put a password on the pdf file. I am only stuck at this part.

I also tried selecting the sheets through the code (sheet(index).select false) and then doing an selectedsheets.printout, but that has the same problem. I am thinking the ccombineall is not working right.


Dim PDFPrinter As Object
Dim PDFName As String, PDFPath As String
Dim MasterPassword As String, UserPassword As String
PDFName = "mailedpdf.pdf"
PDFPath = ThisWorkbook.Path & Application.PathSeparator
MasterPassword = "test123"
UserPassword = "test321"


Set PDFPrinter = CreateObject("PDFCreator.clsPDFCreator")
If PDFPrinter.cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical + _
vbOKOnly, "Error!"
Exit Sub
End If
With PDFPrinter
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = PDFPath
.cOption("AutosaveFilename") = PDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cOption("PDFUseSecurity") = 1
.cOption("PDFOwnerPass") = 1
.cOption("PDFOwnerPasswordString") = MasterPassword

'To set individual security options
.cOption("PDFDisallowCopy") = 1
.cOption("PDFDisallowModifyContents") = 1
'.cOption("PDFDisallowPrinting") = 1

'To force a user to enter a password before opening
.cOption("PDFUserPass") = 1
.cOption("PDFUserPasswordString") = UserPassword

'To change to High encryption
.cOption("PDFHighEncryption") = 1
.cClearCache
End With
'todo: having problem with printing multiple sheets

ThisWorkbook.Sheets("Inspection Form").PrintOut copies:=1, ActivePrinter:="PDFCreator"
ThisWorkbook.Sheets("Detail Photos").PrintOut copies:=1, ActivePrinter:="PDFCreator"
Do Until PDFPrinter.cCountOfPrintjobs = 2
DoEvents
Loop
With PDFPrinter

.cCombineAll
.cPrinterStop = False
End With
Do Until PDFPrinter.cCountOfPrintjobs = 0
DoEvents
Loop
PDFPrinter.cClose
Set PDFPrinter = Nothing