BusinessObjects Board

VBA code to insert a report tab in a specific order

I have a report which contains 2 tabs Lets say TabA and TabB and I am using a macro to duplicate those tabs for each site.currently when I duplicate those tabs they are inserted as TabA(1), TabA(2), TabA(3), TabB(1), TabB(2), TabB(3) on my report.
Is is possible for me to insert those tabs in a specific position ? because I want to place them like tabA(1), TabB(1), TabA(2), TabB(2), TabA(3), TabB(3)
Any help will be appreciated


Bahadurkhan (BOB member since 2006-05-04)

Please move to the SDK forum


jac :australia: (BOB member since 2005-05-10)

I will move this topic from the BusObj Classic forum to the SDK forum.

I think you are out of luck. When you do the Duplicate function manually, you don’t get to specify the location. It’s no different via SDK.


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

Here’s an out of the box idea. Instead of using the duplicate function, how about adding blank reports and applying a template instead? That way you control the order. The following code duplicates Report1 and Report2 in a controlled order:

Sub DuplicateTabsInOrder()

    Dim Rpt As Report
    Dim TemplateDir As String

    'create templates
    TemplateDir = Application.GetInstallDirectory(boTemplateDirectory)
    ThisDocument.Reports("Report1").Activate
    Call ThisDocument.SaveAs(TemplateDir & "\Report1.ret")
    ThisDocument.Reports("Report2").Activate
    Call ThisDocument.SaveAs(TemplateDir & "\Report2.ret")

    'add blank reports, rename, and apply template
    Set Rpt = ThisDocument.Reports.Add
    Rpt.Name = "Report1 (1)"
    Call Rpt.ApplyTemplate("Report1")
    Set Rpt = ThisDocument.Reports.Add
    Rpt.Name = "Report2 (1)"
    Call Rpt.ApplyTemplate("Report2")

End Sub

Depending on the complexity of your reports, the possible limitation is that using this “apply template” method may not duplicate the report exactly.


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

Thanks lot , I tried that and it works great


Bahadurkhan (BOB member since 2006-05-04)

Glad it worked for you!


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