Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ivan_will
Partner - Creator II
Partner - Creator II

Using a macro button to open an existing pdf. report ?

When I click on a button in a qlikview sheet , I want to open ana existing pdf report ? I think I should use macros , but don't have the macro codes for this operation !

4 Replies
ivan_will
Partner - Creator II
Partner - Creator II
Author

My idea is that some of the customers use qlikview via a browser! so they do not have the menu "reports" ! and need to use some reports that have been already created!

Not applicable

Any reason why your not creating a text object, and then actions>add>external>launch?

kamalqlik
Partner - Specialist
Partner - Specialist

Try to use this...

Hope this code help you

sub ReportCheck

set var = ActiveDocument.Variables("vCreatePDF")

val = var.GetContent.String

if val = 1 then

call CreateReports

var.SetContent 0, true

end if

End Sub

'***************************************************

'Functions creates the reports in PDF format

'***************************************************

sub CreateReports

tempFolder = "D:\DataPDF"

reportID = "RP01"

set rep = ActiveDocument.GetReport(reportID)

'set vShow = ActiveDocument.Variables("vShow")

'vShow.SetContent "on", true

reportName = rep.Name

'Create the file name with path

reportFile = tempFolder & "\" & reportID & "_" & reportName & ".pdf"

'print the report

printReportPDF reportID, tempFolder 'Call the function

'Rename the report

'checkOutputFile reportFile, tempFolder 'Call the function

'call ClearDefault() 'Call the function

end sub

'***************************************************

'Actual function to print the PDF format without being asked for location to save

'***************************************************

function printReportPDF(oReport, pdfLocation)

Set WSHShell = CreateObject("WScript.Shell")

WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\DefaultLocation", pdfLocation, "REG_SZ"

WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\UseJobName", "1", "REG_SZ"

WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\UseDefaultLocation", "1", "REG_SZ"

'QV Print

ActiveDocument.PrintReport oReport, "PDFCreator",false

set WSHShell = nothing

end function

and than create the

"I created a trigger OnOpen to run macro "ReportCheck"

Hope this help you.

Thanks and regards

Kamal

Not applicable

I wonder whether you have ever tried to convert pdf files into text? How about this one I found by Google? Any suggetsion will be appreciated. Thanks in advance.