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

Macro to print the Bookmark in to PDF

Hi,

Is it possible to print the Bookmark in to the PDF using Macro.

2 Replies
vikasmahajan

Sub PrintReports       

   'Lets create a temporary bookmark, to store the current selection

   ActiveDocument.CreateUserBookmark "PrintMakroStorage"

   'Pls create a tablebox containing all reports and ID's to be printed out

   Set ReportTable = ActiveDocument.GetSheetObject("TB15")

   FOR RowIter = 1 TO ReportTable.GetRowCount - 1

        reportID = (ReportTable.GetCell(RowIter,0).text)

        reportHIRARCHY = (ReportTable.GetCell(RowIter,1).text)

        reportGROUP = (ReportTable.GetCell(RowIter,2).text)

        reportNAME = (ReportTable.GetCell(RowIter,3).text)

        MyFilterField = (ReportTable.GetCell(RowIter,4).text)

        MyFilterSelection = (ReportTable.GetCell(RowIter,5).text)

        'Clear All

        ActiveDocument.ClearAll   

        if MyFilterField <> "" THEN

            ActiveDocument.Fields(MyFilterField).Select MyFilterSelection

        end if

        'call the print job

        Print_PDF reportHIRARCHY, reportNAME, reportID, reportGROUP

        'reset the start selections

        ActiveDocument.RecallUserBookmark "PrintMakroStorage"

    NEXT

    ActiveDocument.RemoveUserBookmark "PrintMakroStorage"

End Sub

Sub Print_PDF(FieldValue, ReportName, ReportID, ReportGroup)

    ' Designed for early bind, set reference to Bullzip PDF Printer

    Dim sPDFName

    Dim sPDFPath

    '/// Change the output file name here! ///

    sPDFName = ReportName '& " - " & FieldValue

    sPDFPath = "C:\Temp\" & FieldValue & "\2012 08 StandardReporting\" & ReportGroup & "\"

    'For monthly publishing :: sPDFPath = "C:\Users\Administrator\Dropbox\" & FieldValue & "\2012 08 StandardReporting\" & ReportGroup & "\"

    MyPrintPDFWithBullZip sPDFPath&sPDFName&".pdf"

    'Wait until the print job has entered the print queue

    ActiveDocument.GetApplication.Sleep 2000

    ' Print the QlikView Report

    ActiveDocument.PrintReport ReportID, "Bullzip PDF Printer"

    'Wait until PDF creator is finished then release the objects

    ActiveDocument.GetApplication.Sleep 1000

End Sub

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
ThornOfCrowns
Specialist II
Specialist II

Is there a particular reason you're necro'ing old threads Vikas Mahajan?