BusinessObjects Board

VBA macro to jump from tab to tab

Hello
I would like to add a navigation button to a BO 6.5 reports that enables the user to “jump” to the next Tab in the report. Back and Forward arrows would be nce as well.

Hans


hans (BOB member since 2006-10-25)

You could create such macro (custom toolbar), but why? Select the Map tab on the Report Manager (on the left), and you will see a “clickable” list of report tabs. It’s the same number of clicks, but no coding. Also, the Map tab has another advantage if the report is sectioned (master / detail), because there are “clickable” links to the individual sections as well.


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

Hi
thanks a lot. I’m familiar with the Map but I have a report called ClientCockpit which provides a VBA menu where users can select a Client and then all taps (25) in the report are set to that client providing all information they need. To avoid that users have to go back to the main menu I would like to add to some tabs buttons which they can use to go quckly to related tabs like for example: from a highly aggregated tab on results to a more detailed tab.
My ultimate goel is to have Web like navigation in the report.

Hans


hans (BOB member since 2006-10-25)

I had actually developed some VBA code for this purpose, but never implemented it. Amazingly, I was able to find it! There are actually four “VCR-like” options … First, Previous, Next, and Last:

Option Explicit
Dim TabNum As Integer 'allows up to 32,767 tabs!

Sub FirstTab()
    TabNum = 1
    ActiveDocument.Reports(TabNum).Activate
End Sub

Sub PreviousTab()
    TabNum = CurrentTab - 1
    If TabNum = 0 Then TabNum = 1
    ActiveDocument.Reports(TabNum).Activate
End Sub

Sub NextTab()
    TabNum = CurrentTab + 1
    If TabNum > MaxTab Then TabNum = MaxTab
    ActiveDocument.Reports(TabNum).Activate
End Sub

Sub LastTab()
    ActiveDocument.Reports(MaxTab).Activate
End Sub

Function CurrentTab() As Integer
    For CurrentTab = 1 To MaxTab
        If ActiveReport.Name = ActiveDocument.Reports(CurrentTab).Name Then
            Exit Function
        End If
    Next CurrentTab
End Function

Function MaxTab() As Integer
    MaxTab = ActiveDocument.Reports.Count
End Function

If this is of interest, I’ll leave attaching the code to buttons for you. Otherwise, hopefully it’s a nudge in the right direction.


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

Thanks a lot again. The acreting and attaching the makro to button is also something I’m not able to do. I think with one last nudge from you I will have the report where I wanted it to be. Heve a nice WE.


hans (BOB member since 2006-10-25)

Dwayne, could you post the Button code, too?

Thanks


smitchcoff :us: (BOB member since 2006-05-03)

I don’t have a complete example, but you can look at this utility as a place to start. It has code to add menu items. It is the .OnAction property that is set equal to the procedure to be run.


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