BusinessObjects Board

Filter whole report and save tabs seperatly

Hello,

To filter and save a report as PDF I use the next code:

Private Sub Klant_NV_A_D()
Dim mydoc As Document
Dim myFilterVar As DocumentVariable
Dim myrpt As Report
Dim i, j, noOfReports, intNumChoices As Integer
Dim myFilterChoices As Variant
Dim strNextValue As String

Set mydoc = ActiveDocument

mydoc.Application.Interactive = False

mydoc.Variables.Item("Klantnaam vanaf:").Value = "A %"

mydoc.Variables.Item("Klantnaam t/m:").Value = "DZZZ%"

mydoc.Refresh

Set myFilterVar = mydoc.DocumentVariables("KlantNaam")

intNumChoices = UBound(myFilterVar.Values(boUniqueValues))

myFilterChoices = myFilterVar.Values(boUniqueValues)
For i = 1 To intNumChoices

strNextValue = myFilterChoices(i)

noOfReports = mydoc.Reports.Count
For j = 1 To noOfReports
Set myrpt = mydoc.Reports.Item(j)

myrpt.AddComplexFilter myFilterVar, "=<KlantNaam>= " &amp; """" &amp; strNextValue &amp; """"

myrpt.ForceCompute

Next j

Dim DocPDF_Dir As String

DocPDF_Dir = "C:\test\"

Dim Document_Name As String

Document_Name = strNextValue

ActiveDocument.ExportAsPDF ("C:\test\" &amp; strNextValue &amp; ".pdf")
Next i

myrpt.AddComplexFilter myFilterVar, "=(1=1)"
myrpt.ForceCompute

End Sub

Now I want to filter the whole report and then save each tab seperatly as PDF.

I hope someone has an answer.

Halmar


halmar76 :netherlands: (BOB member since 2006-11-07)

Move the export inside of the ā€œjā€ loop, and use myrpt.ExportAsPDF() to save the report tab individually.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)