PDFcreator issue with vbscript excel


I made a program in excel which would copy paste client info into a word doc and pdf it automaticly (and save it). Everything worked great till a few days ago.

Before word would open, and get pdf'ed automaticly using pdfcreator, you could see a tray icon appearing first in red, then green while after it dissapeares.

Now pdf creator just stay reds, nothing is included in the list except all options are saved.

Fyi I change the config of pdfcreator in vbscript so it saves the file in a specific folder... That works.

Any ideas, why suddenly it stopped working?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Unless you want people to just guess, it might be a good idea to start by posting your code, and then describing, in great detail, what changes took place when the problem began.

A sample spreadsheet might not hurt, either, so that we have correct data to work with.  There could be something wrong in the source data that the PDF creator doesn't like..
MutsopAuthor Commented:
Well the point is that I haven't changed my code.
It worked like a few days ago, then suddenly nothing.

I copied the files onto the server and checked with another pc and it works.

The code however isn't well written, I still need to clean it :D
Function DOC2PDF(sDocFile, sPDFFile)
      Dim fso ' As FileSystemObject
      Dim wdo ' As Word.Application
      Dim wdoc ' As Word.Document
      Dim wdocs ' As Word.Documents
      Dim sPrevPrinter ' As String
      Dim sPDFName As String
      Dim sPDFPath As String
      Set fso = CreateObject("Scripting.FileSystemObject")
      Set wdo = CreateObject("Word.Application")
      wdo.Visible = True
      Dim pdfjob As PDFCreator.clsPDFCreator
      Set pdfjob = New PDFCreator.clsPDFCreator
      pdfjob.cStart ("/NoProcessingAtStartup")
      sPDFPath = "Z:\Offertes\" & cbx_offertefolder.Value
      Dim Klant As String
        If txt_bedrijf.Value = "" Then
            Klant = txt_naam.Value & " " & txt_voornaam.Value
            Klant = txt_bedrijf.Value
        End If
      sPDFName = Klant & " " & sDocFile & ".pdf"
      Set wdocs = wdo.Documents
      sTempFile = fso.GetSpecialFolder(TemporaryFolder) + "\" + fso.GetTempName()
      sDocFile = "Z:\Templates\Formulier\" & sDocFile
      sFolder = "Z:\Templates\Formulier\"
      If Len(sPDFFile) = 0 Then
        sPDFFile = fso.GetBaseName(sDocFile) + ".pdf"
      End If
      If Len(fso.GetParentFolderName(sPDFFile)) = 0 Then
        sPDFFile = sFolder + "\" + sPDFFile
      End If
      With pdfjob
            '/// Change the output file name here! ///
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveDirectory") = sPDFPath
            .cOption("AutosaveFilename") = sPDFName
            .cOption("AutosaveFormat") = 0    ' 0 = PDF
      End With
      ' Remember current active printer
      sPrevPrinter = wdo.ActivePrinter
      wdo.ActivePrinter = "PDFcreator"
      ' Open the Word document
      Set wdoc = wdocs.Open(sDocFile)
        'Paste chart at cursor position
      wdo.ActiveDocument.PrintOut False, , , sTempFile
      wdoc.Close WdDoNotSaveChanges
      wdo.ActivePrinter = sPrevPrinter
      wdo.Quit WdDoNotSaveChanges
      Set wdo = Nothing
        Do Until pdfjob.cCountOfPrintjobs = 1
        pdfjob.cPrinterStop = False
        'Wait until PDF creator is finished then release the objects
        Do Until pdfjob.cCountOfPrintjobs = 0
      pdfjob.cOption("UseAutosave") = 0
      Set pdfjob = Nothing
End Function
Private Sub btn_printpdfofferte_Click()
    Dim sDocFile As String
    Dim sPDFFile As String
    Call CopyEntries(Me)
    For I = 0 To lst_offerte.ListCount - 1
        If lst_offerte.Selected(I) Then
            sDocFile = lst_offerte.List(I)
            Call DOC2PDF(sDocFile, sPDFFile)
        End If
End Sub

Open in new window

I really don't use VBA much, but as it is rooted in VBScript I will point out that this line:

      Dim pdfjob As PDFCreator.clsPDFCreator

Won't work.  You need to change it to

Dim pdfjob

Unless you are using Visual Basic.Net and this is in the wrong forum.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MutsopAuthor Commented:
I'll try and fix that when I get back from work.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Document Imaging

From novice to tech pro — start learning today.