Hi Folks
I've got a custom menu group with a menu holding 3 checkboxes. Now, I'd like to make it act like a drop box, that is if one of the 3 buttons gets pressed the other 2 get unpressed.
So far I've got the following XML code:
And the following VBA callbacks:<?xml version="1.0" encoding="utf-8"?> <customUI onLoad="subRibbonOnLoad" xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="false" > <tabs> <tab idMso="TabHome"> <group id="Ansicht_Allg" label="Ansicht Allgemein" insertBeforeMso="GroupClipboard" getVisible="subGetVisible" tag="wsAllg"> <menu id="Menu_wsAllg_Filter" image="Icon_Level" size="large" label="Level" screentip="Level an Detail auswählen"> <checkBox id="CheckBox_5_wsAllg" tag="L1" label="Level 1 Komptetenzen" getPressed="subGetPressed" screentip="Level 1 Kompetenzen" onAction="btnMatrixAnsicht" /> <checkBox id="CheckBox_6_wsAllg" tag="L2" label="Level 2 Themen" getPressed="subGetPressed" screentip="Level 2 Themen" onAction="btnMatrixAnsicht" /> <checkBox id="CheckBox_7_wsAllg" tag="L3" label="Level 3 Trainings" getPressed="subGetPressed" screentip="Level 3 Trainings" onAction="btnMatrixAnsicht" /> </menu> </group> </tab> ......
I've tried with getPressed, however, the corresponding subGetPressed doesn't get called when pressing any of the 3 buttons.'Menüband laden (Callback für customUI.onLoad; wird beim Öffnen der Datei ausgeführt) Sub subRibbonOnLoad(ribbon As IRibbonUI) 'Variablen dimensionieren/speichern Set rbnRib = ribbon If Not ObjPtr(ribbon) = 0 Then With wsHelfer .Unprotect .Range("B3").Value = ObjPtr(ribbon) .Protect End With End If End Sub 'Menüband aktualisieren/neu zeichnen (Callback für CustomUI.invalidate; wird beim Öffnen/Blattwechsel ausgeführt) Sub subRefreshRibbon(Tag As String) 'Variablen dimensionieren/speichern strRibbonTag = Tag If rbnRib Is Nothing Then If Not CStr(wsHelfer.Range("B3")) = "" Then Set rbnRib = fctgetribbon(wsHelfer.Range("B3").Value) rbnRib.Invalidate End If Else rbnRib.Invalidate End If End Sub 'Pointer für zu ladendes Menüband ermitteln (i.e Speicherort des Menübandstatuses im Arbeitsspeicher) Function fctgetribbon(ByVal rbnPointer As LongPtr) As IRibbonUI CopyMemory rbnRib, rbnPointer, LenB(rbnPointer) Set fctgetribbon = rbnRib End Function 'Menüband wechseln (Callback für CustomUI.subGetVisible; wird beim Blattwechsel ausgeführt) Sub subGetVisible(control As IRibbonControl, ByRef visible) If control.Tag = strRibbonTag Then visible = True Else visible = False End If End Sub Sub subGetPressed(control As IRibbonControl, ByRef pressed) End Sub 'Button onAction (Callback für CustomUI.onAction; wird beim Drücken eines Buttons ausgeführt) Sub btnMatrixAnsicht(control As IRibbonControl, pressed As Boolean) Dim wsAktivesBlatt As Worksheet: Set wsAktivesBlatt = ThisWorkbook.ActiveSheet Dim strButtonTyp As String Dim strButtonIndex As String Dim strAnsichtlevel As String Dim blnButtonGedrückt As Boolean If control.Tag Like "L*" Then strButtonTyp = "Level" strAnsichtlevel = Right(control.Tag, 1) Else strButtonTyp = "Kompetenzen" strAnsichtlevel = control.Tag End If If pressed = True Then blnButtonGedrückt = True Else blnButtonGedrückt = False End If strButtonIndex = Mid(control.ID, InStr(1, control.ID, "_") + 1, 1) subMatrixAnsicht wsAktivesBlatt, strButtonTyp, strButtonIndex, strAnsichtlevel, blnButtonGedrückt End Sub
Any ideas how this can be done?



) to make just a small example that seems to do what you want