chuckschilling
Programmer
Hi all! I'm developing an Excel worksheet to act as something of a custom control and in so doing am disabling all command bars and then re-enabling them using the
following code in the workbook Open event:
For Each menuOption In Application.CommandBars
'Suppress all the command bars
menuOption.Enabled = False
Next
This works just fine in disabling all of the Excel command bars.
I use the following code to re-enable the command bars in the Deactivate event of the Workbook:
For Each menuOption In Application.CommandBars
'Re-enable the command bars
menuOption.Enabled = True
Next
All of the command bars are re-enabled, with the exception of the main Excel command bar ("Worksheet Menu Bar"
. I've tried enabling it explicitly, to no avail, and have also tried the enabling method in the BeforeClose event of the workbook, which also does not work.
When I use the exact same code in a control in a different workbook, it works just fine. Am I missing something? Is there something special about the Worksheet Menu Bar control that I just don't get?
following code in the workbook Open event:
For Each menuOption In Application.CommandBars
'Suppress all the command bars
menuOption.Enabled = False
Next
This works just fine in disabling all of the Excel command bars.
I use the following code to re-enable the command bars in the Deactivate event of the Workbook:
For Each menuOption In Application.CommandBars
'Re-enable the command bars
menuOption.Enabled = True
Next
All of the command bars are re-enabled, with the exception of the main Excel command bar ("Worksheet Menu Bar"
When I use the exact same code in a control in a different workbook, it works just fine. Am I missing something? Is there something special about the Worksheet Menu Bar control that I just don't get?