Forum Discussion
How to restore selected ribbon tab after report with a custom ribbon is closed?
- Dec 05, 2024
after you the report is closed and after showing the Switchboard ribbon, you Activate which tab the closing report belongs, eg:
gobjRibbon.ActivateTab "tab2"
I am aware of ActivateTab method.
However, for gobjRibbon.ActivateTab "tab2" to work, I need to know that “tab2” was an active tab from which report button has been pressed.
I am looking for a simple solution to find our from which Tab user open the report.
The only way to achieve that at the moment is to hard code tab's names into onAction event for each report buttons. I try to avoid it, as our database solution contains 300+ reports.
- arnel_gpDec 05, 2024Iron Contributor
that is very easy, manually save the tab name to a Tempvar or Global variable:
Sub OnActionButton(control As IRibbonControl) Select Case control.ID Case "Report01" 'Report01 is on Tab1 Tempvars("tvarTab") = "Tab1" 'open the report01 below Case "Report02" 'Report02 is on Tab2 Tempvars("tvarTab") = "Tab2" 'open report02 below Case Else Msgbox "Button """ & control.ID & """ clicked." End Select End Sub
now when you the report closed just:
gobjRibbon.ActivateTab Tempvars!tvarTab.Value