misi01
New member
I have a customized ribbon that includes the following code:-
I have also created a diddy workbook with 2 sheets called Enable and Disable (which I've attached). Needless to say, if I select the Disable sheet, I want the button (SHB_Button) to be disabled as well as the SHB_Menu option.
What I'm seeing is that it seems as if you have to disable both Button_1 and Button_2 for me not to be able to select the Option button_id. If either is enabled, then I can still open the Option button.
Am I missing something ? I assumed that if I disabled SHB_button and/or SHB_Menu then buttons 1 & 2 would never be shown by clicking on the Option "option". I'll include my "disabling" code as well
View attachment Enable_disable_menu_button.xlsm
Code:
<group id="customGroup1">
<splitButton id="mySplitButton" size="large">
<button id="SHB_button" getEnabled="get_enabled_SHB_button" image="SHB_small" label="Option"/>
<menu id="SHB_Menu" getEnabled="get_enabled_SHB_menu" itemSize="normal">
<!-- use itemSize = large or use normal -->
<button id="Button_1" getEnabled="get_enabled_button1" imageMso="TableInsert" label="Button 1" onAction="Run_button1"/>
<button id="Button_2" getEnabled="get_enabled_button2" imageMso="TableInsert" label="Button 2" onAction="Run_button2"/>
</menu>
</splitButton>
</group>
I have also created a diddy workbook with 2 sheets called Enable and Disable (which I've attached). Needless to say, if I select the Disable sheet, I want the button (SHB_Button) to be disabled as well as the SHB_Menu option.
What I'm seeing is that it seems as if you have to disable both Button_1 and Button_2 for me not to be able to select the Option button_id. If either is enabled, then I can still open the Option button.
Am I missing something ? I assumed that if I disabled SHB_button and/or SHB_Menu then buttons 1 & 2 would never be shown by clicking on the Option "option". I'll include my "disabling" code as well
Code:
Private Sub Worksheet_Activate()
Dim answer As String
Application.EnableEvents = True ' Just in case ....
' Ensure the callback is performed that will change the buttons to disabled
'
g_SHB_button_Enabled = False
g_rbxIRibbonUI.InvalidateControl gRBX_SHB_BUTTON
' I've also included the following code to no avail
g_SHB_Menu_Enabled = False
g_rbxIRibbonUI.InvalidateControl gRBX_SHB_MENU
End Sub