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: 
pkelly
Specialist
Specialist

Loop through all filter values then print to PDF

Hi all...

I have a list box with about 30 entries in it (these could change).

For each entry, I want to...

1) Select it.

2) Run a macro that will create a PDF and e-mail the file.

I have already written a report which creates a PDF then e-mails the file so that part is covered.

What I don't know how to do is interrogate my list box then apply a filter, then move on to the next one until I have worked my way through them all.

Hope that makes sense...

Any help greatly appreciated.

Regards

Paul

PS - looping over possible values in field won't help me as I need an individual PDF for each selection.

11 Replies
pkelly
Specialist
Specialist
Author

Apologies for the delay - have been on holiday...

The attached qvw shows how I managed to get it to loop through the values.

Points to note...

I am using "PDF-XChange 3.0" as my PDF printer.

I have a VBScript file which first of all checks to see if QlikView is running.

The reason for this is that, I have various reports running from a batch file and found that if I didn't wait until the previous report had completed, I could end up e-mailing the wrong PDF - then opens the qvw and clicks BU80a which starts the macro running.

================================================================

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")

' MsgBox objQV

If TypeName(objQV) = "Global" Then

  ' QlikView is Running

  boolLoopAgain = True

Else

  Set MyApp = CreateObject("QlikTech.QlikView")
  Set MyDoc = MyApp.OpenDoc ("C:\QlikViewV13\Apps\PR_Performance\PR07.qvw","","")
  Set ActiveDocument = MyDoc
  ActiveDocument.Reload
  ActiveDocument.GetSheetObject("BU80a").Press

End If

Loop While boolLoopAgain

========================================================================

Hope this helps...

Regards

Paul

Andrius45
Contributor III
Contributor III

Hey Paul,

First of all big thanks for this amazing macro and even an example file. I am trying to implement it right now and do everything step by step by your example. Are you still using the same macro or have you tweaked it since?