0.9.5 Freezes on cClose
Hi all,
I have searched the forum and found lots of references to PDFCreator "freezing" but failed to find a definitive answer to the problem. This is my first day using PDFCreator and could do with some expert advice.
I am using:
Windows XP Pro
MS Excel 2003
PDFCreator 0.9.5
Creating a print to pdf VB macro controlled from a button control on an excel worksheet.
Using early binding technique
Whenever i let the macro "free run" it hangs on the cClose command. PDFCreator doesnt close, sits in the task list consuming 100% procesor time and excel eventually reports an error "waiting for application to complete OLE activity"
If i put a breakpoint in just above the cClose command and then single step everything is fine. I assumed that this was a timing thing so tried to put a few "waits" in before the cClose but with no success.
Can anyone suggest a robust solution to this problem, I have attached the code fragment I am using (based on the example on the web)?
...
'Wait until all print jobs have entered the print queue
Do Until pdfjob.cCountOfPrintjobs = 2
DoEvents
Loop
'Combine all PDFs into a single file and stop the printer
With pdfjob
.cCombineAll
.cPrinterStop = False
End With
'Wait until PDF creator is finished then release the objects
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
pdfjob.cClose
Set pdfjob = Nothing
End Sub
Thanks thesmilyface, I have given that a try initially by putting in a 30 second "wait" command after the cClose command.
Unfortunately no change macro still hangs with PDFCreator running at 100% processor load and excel complaining about "waiting for application to complete OLE...."
When I kill the PDFCreator task in the Windows Task Manager the macro drops into debug mode at the cClose command ie the macro never got to the newly inserted wait command.
The problem seems to be the cClose command never completing.