Code don't work for PDFcreator


The code below :

After execute "Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")" the value is TRUE
and after execute "With pdfjob" the value is FALSE.
How is this possible?

    Shell "taskkill /f /im PDFCreator.exe", vbHide
    Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
    With pdfjob
        If .cStart("/NoProcessingAtStartup") = False Then
            MsgBox "Can't initialize PDFCreator.", vbCritical + vbOKOnly, "PrtPDFCreator"
            Exit Sub
        End If
        .cOption("UseAutosave") = 1
        .cOption("UseAutosaveDirectory") = 1
        .cOption("AutosaveDirectory") = PDFpath
        .cOption("AutosaveFilename") = PDFnaam
        .cOption("AutosaveFormat") = 0    ' 0 = PDF
    End With
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
What value? Do you mean that pdfJob is not created correctly? Or that the cStart method returns False?

If it does, then I'd suspect a problem with the installation of PDFCreator. Try removing and reinstalling.

Have you tried commenting out the Shell line? I'm not sure why you'd need that anyway. Generally you would not kill a task before starting something like this. If you find that you have rogue tasks in your Task list, then you need to take steps to resolve this - be sure your code isn't leaving remnants behind, for example, and Close/End everything you Open/Start.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Are you sure you meant to accept my comment with a B grade? Did my comment somehow resolve your problem? If it didn't, then you shouldn't accept it as a solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.