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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Print All Reports Macro

Hello All,

I am attempting to create a Macro that will print all Reports within a .QVW. I can easily create a macro that looks like this:

Sub Print_Reports

ActiveDocument.PrintReport "RP01"

ActiveDocument.PrintReport "RP02"

ActiveDocument.PrintReport "RP03"

End Sub

But, what if I add another Report? I would have to remember to add it to the macro.

What I would like to do is loop thru an array of the Reports and print each. Something like this:

Sub Print_Reports

Set reps = ActiveDocument.GetDocReports

For i = 0 to reps.Count - 1

Set rep = reps.Item(i)

ActiveDocument.PrintReport rep

Next

End Sub

However, this doesn't work. It doesn't like the syntax of "ActiveDocument.PrintReport rep". How do I call each report in proper syntax?

Thanx





Labels (1)
4 Replies
boorgura
Specialist
Specialist

Try this:

Set rep = reps.Item(i).text

ActiveDocument.PrintReport rep

Let me know if it works.

Not applicable
Author

Sorry..no joy. It doesn't like the syntax "Set rep = reps.Item(i).text"

boorgura
Specialist
Specialist

Try this:

For i = 0 to reps.Count - 1

ActiveDocument.PrintReport reps.Item(i).text

Next

Not applicable
Author

Got it to work. Here's the syntax:

"ActiveDocument.PrintReport rep.id"

Thanx for your help.