Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Try this:
Set rep = reps.Item(i).text
ActiveDocument.PrintReport rep
Let me know if it works.
Sorry..no joy. It doesn't like the syntax "Set rep = reps.Item(i).text"
Try this:
For i = 0 to reps.Count - 1
ActiveDocument.PrintReport reps.Item(i).text
Next
Got it to work. Here's the syntax:
"ActiveDocument.PrintReport rep.id"
Thanx for your help.