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

E-mail Sheet 1 of a QlikView Report

Hi All....

I have a QlikView report where I would like to e-mail sheet 1 to a list of users.

I believe that I will have toi somehow export the sheet to a pdf. To this end I have installed the QlikView PDF printer.

Other than that, I do not have a clue what I should be doing (that includes an set up outside of the report).

Any assistance greatly appreciated.

Regards

Paul

1 Solution

Accepted Solutions
pkelly
Specialist
Specialist
Author

Think I have cracked it...

Did a check to see if QlikView was running or not....

Dim objQV
Dim boolLoopAgain

boolLoopAgain = False

Do
On Error Resume Next

boolLoopAgain = False

' Try to grab a running instance of QlikView...

Set objQV = GetObject(, "QlikTech.QlikView")


If TypeName(objQV) = "Global" Then

' QlikView is Running

boolLoopAgain = True

Else

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("C:\QlikViewFiles\Timbmet_Live\Reports\PKTEST.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU104").Press

End If

Loop While boolLoopAgain

View solution in original post

4 Replies
pkelly
Specialist
Specialist
Author

Hi All

I have managed to progress this a bit further by cobbling together rep[lies to other questions and also the e-mail example if the share area...

Have gotten to the point whereby...

1) I have a button on my report which, when clicked, will create a pdf from a report and also e-mail the file.

2) Using the post reload trigger, if I open the report and click on the reload button it reloads and sends the report.

I am now trying to automate this in that, when the document reloads from the batch file, it will send the PDF by e-mail.

My batch file syntax is...

"C:\Program Files (x86)\QlikView\QV.exe" /r C:\QlikViewFiles\emailForForum.qvw

The report reloads but no PDF / e-mail is fired off...

Is there something else which I should be doing?

(I have attached an example qvw report)

pkelly
Specialist
Specialist
Author

Okay...have managed some more progression on this....

See from other posts that other users have had issues with the post reload / batch file scenario...

Hav created the vbs below which does the job for me....

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("C:\QlikViewFiles\Timbmet_Live\Reports\PKTEST.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU104").Press

In my app I save and quit the file...

If I have qlikview open, the script takes over this session and then quits at the end.

Is it possible to get the create object to open a new session of QlikView rather than take over any existing?

pkelly
Specialist
Specialist
Author

Think I have cracked it...

Did a check to see if QlikView was running or not....

Dim objQV
Dim boolLoopAgain

boolLoopAgain = False

Do
On Error Resume Next

boolLoopAgain = False

' Try to grab a running instance of QlikView...

Set objQV = GetObject(, "QlikTech.QlikView")


If TypeName(objQV) = "Global" Then

' QlikView is Running

boolLoopAgain = True

Else

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("C:\QlikViewFiles\Timbmet_Live\Reports\PKTEST.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU104").Press

End If

Loop While boolLoopAgain

Not applicable

Hi Paul,

If I would just like to send to PDF - (I have pdfwriter installed)

I use the below macro and it seems to run, but no pdf is generated.

Not sure what I'm doing wrong?

sub printRP01

          printReportPDF "C:\TEST.pdf"

          ActiveDocument.GetApplication.Sleep 2000

          ActiveDocument.PrintReport "RP01", "QlikviewPDF"

          ActiveDocument.GetApplication.Sleep 2000

end sub

'===========================================================================

Function printReportPDF(pdfOutputFile)

          Set WSHShell = CreateObject("WScript.Shell")

          WSHShell.RegWrite "HKCU\Software\QlikviewPDF\OutputFile", pdfOutputFile, "REG_SZ"

          WSHShell.RegWrite "HKCU\Software\QlikviewPDF\BypassSaveAs", "1", "REG_SZ"

          Set WSHShell = nothing

End function