ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PDFCreator code (https://www.excelbanter.com/excel-programming/407943-pdfcreator-code.html)

Brettjg

PDFCreator code
 
Hi, I'm using the following code. It works, but every now and then PDFCreator
is left running and fails the next time until I kill it through the task
manager. This is not very practical because I have massive macros that run
PdfCreator several times and then email out the pdf, so I get crashes.


Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
Application.Wait Now + TimeValue("0:0:10")

pdfjob.cClose
Set pdfjob = Nothing
Application.ActivePrinter = printer_memory

You'll note the huge wait time that I have to put in to restrict this problem.

Is there another way of killing the application first before using it again?
Thanks, Brett


All times are GMT +1. The time now is 02:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com