PSFCreator Inconsistanly Creating PDF File from Word Document

I've created some code that I can pass a word.document object to, and it then converts the word document to a PDF file.  The code sometimes works and sometimes does not?  If I pass 50 word.document objects to it in a loop, I will get 30 converted docuemnts but 20 that nothing occurs with?  I'm at a loss as to what is causing this.  Hope someone can help me.  Here's the vba code I'm using.

Public PDFCreator1 As PDFCreator.clsPDFCreator

Private ReadyState As Boolean, DefaultPrinter As String
Public Sub CreatePDFFile(Doc As Word.Document)

Set PDFCreator1 = New clsPDFCreator


If PDFCreator1.cStart("/NoProcessingAtStartup") = False Then
    MsgBox "Process Failed"
End If

With PDFCreator1
    .cOption("UseAutoSave") = 1
    .cOption("AutosaveFilename") = Mid(Doc.Name, 1, Len(Doc.Name) - 4) & ".pdf"
    .cOption("UseAutoSaveDirectory") = 1
    .cOption("AutosaveDirectory") = Doc.Path & Application.PathSeparator
    .cOption("AutosaveFormat") = 0
    .cSaveOptions
    .cClearCache
    .cDefaultPrinter = "PDFCreator"
    .cPrinterStop = True
End With


Doc.PrintOut

Do Until PDFCreator1.cCountOfPrintjobs = 1
    'MsgBox PDFCreator1.cCountOfPrintjobs
    DoEvents
    Sleep 3000
Loop


DoEvents
PDFCreator1.cClose
Sleep 3000

Set PDFCreator1 = Nothing
End Sub

It looks like no one was able to help me with a solution, but I was able to find one on my own.  I believe that my above code was shuttinh down the PDFCreator before it actually had a chance to generate the PDF copy.  I'm not sure why since I was monitoring the countofprintjobs property, but once I changed my code to look at both the number of prints, and monitor the output folder for a produced file, then shut down PDF Creator, everything started working after that.

Here is the code revision that worked for me.

Public Sub CreatePDFFile(Doc As Object)
Dim brestart As Boolean
Set PDFCreator1 = New clsPDFCreator


Do
    brestart = False
    Set PDFCreator1 = New PDFCreator.clsPDFCreator
    If PDFCreator1.cStart = False Then
        'PDF Creator is already running.  Kill the existing process
        Shell "taskkill /f /im PDFCreator.exe", vbHide
        DoEvents
        Set PDFCreator1 = Nothing
        brestart = True
    End If
Loop Until brestart = False

   
With PDFCreator1
    .cDefaultPrinter = "PDFCreator"
    .cOption("UseAutoSave") = 1
    .cOption("UseAutoSaveDirectory") = 1
    .cOption("AutosaveDirectory") = Doc.Path & "\\"
    .cOption("AutosaveFilename") = Mid(Doc.Name, 1, Len(Doc.Name) - 4) & ".pdf"
    .cOption("AutosaveFormat") = 0
    .cClearCache
End With


Doc.PrintOut

Do Until PDFCreator1.cCountOfPrintjobs = 0
    'MsgBox PDFCreator1.cCountOfPrintjobs
    DoEvents
    Sleep 3000
Loop

Do
    DoEvents
Loop Until Dir(Doc.Path & "\\" & Mid(Doc.Name, 1, Len(Doc.Name) - 4) & ".pdf") = Mid(Doc.Name, 1, Len(Doc.Name) - 4) & ".pdf"

DoEvents
PDFCreator1.cClose
Shell "taskkill /f /im PDFCreator.exe", vbHide
Sleep 3000

Set PDFCreator1 = Nothing
End Sub