Anyone written any code to work with the CommandBar object?
I have a custom menubar, with 6 buttons, and up to 3 levels of nested menus,
such as:
File
File | Print
(that's 2 levels)
Projects
Projects | Add
Projects | Add | Type 1
Projects | Add | Type 2
(3 levels)
Reports
(1 level)
I want to iterate the CommandBar collection with a loop, down to the Nth
level, setting all the objects Enabled and Visible. Something like my code
below, but mine bombs when there's no nested menu, like on the Reports item
in my example:
Dim menuObject As Object, mObject As Object, mObject1 As Object
Set menuObject = CommandBars("MainMenu")
For Each mObject In menuObject.Controls
mObject.Visible = True
mObject.Enabled = True
For Each mObject1 In mObject.Controls
mObject1.Enabled = True
mObject1.Visible = True
Next mObject1
Next mObject
Thanks