Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apply filters in BO VBA

Status
Not open for further replies.

rudraigh

MIS
Jun 10, 2005
17
US
Hi all,

BO 5.1.3. I have these two reports I run every month. After refreshing them I manually apply various filters and save each filtered version as separate PDF files. I'm already familiar with automating the opening, refreshing and converting reports and can even send them as Novell GroupWise email attachments but can't figure out how to apply filters. Can anyone provide a little code to get me on my way?
Thanks in advance,
Rud
 
Yes, which is okay of course. Now imagine someone doing a search in this topic and finding it.
Wouldn't he/she be interested in a solution?

Ties Blom

 
Yes, just as interested as I was when I posted my question here three days ago.

Are *you* interested in the solution?

If you don't have something constructive to add, stop shaking your finger at me. :)

I built a multidimensional array that holds the filter values and the folders the reports get saved to. I haven't commented anything yet but if somebody *does* ask any questions about this I'll be happy to answer.

Code:
Set doc = Application.Documents.Open(sDocPath & sDocName & sExt)
With doc
    .Activate
    .Refresh
    sDocPath = .Path & "\"
    sDocName = .Name
    sExt = ".rep"
    .SaveAs (sDocPath & sDocName & sExt)
    sExt = ".pdf"
    .ExportAsPDF (sDocPath & sDocName & sExt)
    For i = 0 To UBound(vFltrArray, 2)
        .Activate
        .Reports.Item("IR - Summary by Referral").Activate
        Set rpt = .ActiveReport
        Set dvFilterVar = .DocumentVariables("Referral Current Assignment Unit")
        rpt.AddComplexFilter "Referral Current Assignment Unit", "=" & vFltrArray(0, i)
        .Reports.Item("10-day - Summary by Referral").Activate
        Set rpt = .ActiveReport
        Set dvFilterVar = .DocumentVariables("Referral Current Assignment Unit")
        rpt.AddComplexFilter "Referral Current Assignment Unit", "=" & vFltrArray(0, i)
        rpt.ForceCompute
        .ExportAsPDF (sDocPath & vFltrArray(1, i) & sDocName & sExt)
    Next i
    
End With
 
Do not take my reply as shaking my finger at you. Ending this post with just 'I figured out how to do it' seemed like such an open ending..

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top