Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

create pdf file with macro

Hi everybody,

        I have a little problem and I don't find solution on Internet. I have a macro which generate a pdf file, but I need to change it now

        I want to do differents choices (inside macro) and I need to generate an unique pdf file, but I don't know like I can add a new page in a existent pdf, so I generate the pdf file with the last choice that I do

        I use pdfCreator and it is my code:

       

sub PrintPDF (ReportName, ReportID)

   

   

    nombreFichero = ReportName

   

  

  

  sPDFName = prueba.pdf

  

   

   sPDFPath = "C:"

   set pdfjob = CreateObject("PDFCreator.clsPDFCreator")

   

   

     With pdfjob

     If .cStart("/NoProcessingAtStartup") = False Then

         If .cStart("/NoProcessingAtStartup", True) = False Then

 

           Exit Sub

         End if

         .cVisible = True

      End If

   

      .cOption("UseAutosave") = 1

      .cOption("UseAutosaveDirectory") = 1

      .cOption("AutosaveDirectory") = sPDFPath

      .cOption("AutosaveFilename") = sPDFName

      .cOption("AutosaveFormat") = 0 ' 0 = PDF

      .cClearCache

    End With

   

   

   

     ActiveDocument.PrintReport ReportID, "PDFCreator"

   

   

    ' Wait until the print job has entered the print queue

    Do Until pdfjob.cCountOfPrintjobs = 1

     ActiveDocument.GetApplication.Sleep 20

         'in VBScript use WScript.Sleep(20)

    Loop

    pdfjob.cPrinterStop = False

   ' Wait until PDF creator is finished then release the objects

    Do Until pdfjob.cCountOfPrintjobs = 0

     ActiveDocument.GetApplication.Sleep 20

         'in VBScript use WScript.Sleep(20)

    Loop

   

    'pdfjob.cClose

    Set pdfjob = Nothing

end sub

can anybody help me?

  Best regards

0 Replies