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
Cheers SAMMYPE, appreciate the suggestion. will give it a try.