Is it possible to prevent MS Access from changing the selected ribbon tab when using special ribbon?

When a custom XML UI file is used to add multiple custom ribbon tabs to Access, the selected ribbon tab changes to the first custom tab whenever the form closes.

We load custom feed programmatically from VBA. I created accdb that reproduces the problem . The folder also contains an XML file containing the definition of the tape. It must be in the same directory as the .accdb file.

The problem can be easily demonstrated:

  • open the RibbonTest.accdb database,
  • switch to Tab2 and open Form2 using the button on the ribbon and
  • close form 2.

Note that Tab1 is now active.

Of course, in this small db example, this problem seems very minor. However, we have a very large project with many custom tabs, each of which contains many groups and buttons. Our users are very disappointed that they continue to lose space on the tape every time they close the form.

We investigated a workaround in which we programmatically save the selected tab and restore it when we consider what we need. However, do it reliably. (There is no Office API to automate a feed like this, but this article helped .)

Has anyone else encountered this problem? Did you find a way to prevent tabs from automatically changing?

: , , Office 2010 SP1. (, : , .) RTM- . 1 : "Access " " , ". , Form.RibbonName( ), .

+5
6

-, , , - XML . , "", ( , ). , , Access , .

, Access 2013 , , , , ​​ - .

+3

:

<tab id="tabBogus" label="Bogus" visible="false"></tab>

​​ <tabs>. ! ( / , , .) ( ) ! !

+4

, ( , , , , )

RibbonCode:   : xml :

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onload="OnRibbonLoad" >

:

Private MyRibbon as IRibbonUI
Private ActiveRibbonTab as string

Sub OnRibbonLoad(ribbon As IRibbonUI)
  Set MyRibbon = ribbon
End Sub

Sub RememberRibbonTab
  ActiveRibbonTab=<Do the IAccessibleMagic here>   
End

Sub RecallActiveTab
  If ActiveRibbonTab<>"" then MyRibbon.ActivateTab(ActiveRibbonTab)
  ActiveRibbonTab=""
End

Private Sub Form_Close()
  Remember_RibbonTab
End Sub

Private Sub Form_GotFocus()
  RecallActiveTab
End Sub
+1

!

MS Office 2010 1 (SP1). " (, ..), TCID, . TCID, .

, .

.

+1

, (ALT + Y)

' Used By Send Keys to Select Correct Ribbon Tab.
Enum eRibTabs
    DataEntry = 1
    Reporting = 2
    StockAndParts = 3
    AdminFinance = 4
    DataImport = 5
    OtherAdmin = 6
    Admin = 7
    LocalSystem = 8
End Enum

ms Access "zFrmRibbonSelect" txtTabValue, . ( .

Private Sub Form_Current()
' Select Correct Tab Menu Item
Me.txtTabValue = Me.OpenArgs

End Sub

Private Sub Form_Close()
'Select Correct Tab Menu Item
Dim varTab As Variant

varTab = Me.txtTabValue

SendKeys "%Y" & varTab
SendKeys "{ESC}"
SendKeys "{ESC}"

End Sub

Private Sub Form_Timer()
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub

500 ..

: ( .)

Private Sub Report_Close()
'Select Correct Tab Menu Item
 DoCmd.OpenForm "zFrmRibbonSelect", , , , , acHidden, eRibTabs.StockAndParts
End Sub

, int

Private Sub Form_Close()
'Select Correct Tab Menu Item
    SendKeys "%Y" & eRibTabs.StockAndParts
    SendKeys "{ESC}"
    SendKeys "{ESC}"
End Sub
+1

, , - . ( ), .

, , , , - , , .

Access/office 2010, ( Access/office 2007).

, , , , . , , " ", , , , . , :

Create invoice
Balance invoice
Post invoice
Print invoice (a report).

, - , , .

, , , , group + , , .

As already noted, the above may not be the solution to your problem, but avoiding additional tabs will often help solve many of these problems.

0
source

All Articles