Problems at printing more than one sheet in Exce2007/Vista

About the programming interface for the virtual PDF printer driver.

Moderator: jr

konrad.hauke
Posts: 1
Joined: Thu Aug 16, 2007 5:45 pm

Problems at printing more than one sheet in Exce2007/Vista

Post by konrad.hauke »

I try to print (merge) about ten excel sheets in one PDF document. I use
the COM interface with VBA.

I set the required values in the PDFPrinterSettingsObject, in a loop I save
the settings (runonce.ini) and print the sheets one by one.

My code looks like the following code snipped:
[code]
...
printerFQN = getPrinterFQN("bullzip")

Set settings = New Bullzip.PDFPrinterSettings

Call settings.SetValue("output", pdfOutputPath & pdfDocumentName)
Call settings.SetValue("mergefile", pdfOutputPath & pdfDocumentName)
Call settings.SetValue("mergeposition", "bottom")
Call settings.SetValue("showsettings", "never")
Call settings.SetValue("showpdf", "no")
Call settings.SetValue("showsaveas", "no")
Call settings.SetValue("confirmoverwrite", "no")

For Each wks In ActiveWorkbook.Sheets
On Error Resume Next
If Not IsEmpty(wks.UsedRange) Then
'writes the settings.ini file (False) / runonce.ini (True)
Call settings.WriteSettings(True)
Call wks.PrintOut(Copies:=1, ActivePrinter:=printerFQN)
DoEvents
Call Sleep(cDELAY) 'wait 2000 ms for print job is done
End If
On Error GoTo 0
Next wks

...
[/code]

The macro works fine without any problem on XP/Excel 2003/2007, but on
Vista not all sheets will be printed and an error messag dialog apears sometimes.

Have anybody an idea how to solve this problem.

cu, Konrad