Count of print jobs error


I'm using PDF Creator within excel macro, but unfortunately print job always stuck in spooler. I don't know how to solve this. Please look at my macro below.

I always recieve PDF print but macro is unable to count it a finish procedure.

Also this one is working in excel 2007, but when I use it in 2003 it won't even PDF print out. This one work, but when I turn on Auto Save option, after execution nothing happens, it goes to spooler but without any print out.

I would appreciate if someone can help me to solve this.

Thanks in advance



With PrintPDF
    PrintPDF.cPrinterStop = True
        .cOption("UseAutosave") = 1
        .cOption("UseAutosaveDirectory") = 1
        .cOption("AutosaveDirectory") = SaveStr
        .cOption("AutosaveFilename") = FName
        .cOption("AutosaveFormat") = 0    ' 0 = PDF
End With

ActiveWorkbook.Worksheets("PONUDA").PrintOut copies:=1, ActivePrinter:="PDFCreator"

    Do Until PrintPDF.cCountOfPrintjobs = 1
    PrintPDF.cPrinterStop = False

    Do Until PrintPDF.cCountOfPrintjobs = 0
    Set PrintPDF = Nothing
    Exit Sub
End Sub


I can't really say I entirely know what I'm doing, but I did some trial and error trying to write a similar macro.  What I ended up with was similar to what you have, but after:

PrintPDF.cPrinterStop = False

I included another DoEvents instruction.  Whatever timing problems I must have had seemed to get cleared.  So I ended up w/ somethinglike this:

    'Print the document to PDF
        ActiveSheet.PrintOut Copies:=1, Collate:=True
    'Wait until the print job has entered the print queue
        Do Until pdfjob.cCountOfPrintjobs = 1
        pdfjob.cPrinterStop = False
        DoEvents    '<<<<< new line
    'Wait until PDF creator is finished then release the objects
        Do Until pdfjob.cCountOfPrintjobs = 0

Hope this helps.