jofo
05-25-2008, 01:00 AM
I've been using John Walkenbach's menu maker (can't post link, being a newbie) to produce custom menus. I now wish to programmatically disable and enable the menu that it has created and do the same with submenu items.
I can disable the menu item itself on the Worksheet Menu Bar, but not the submenu items.
Public Sub test()
'Disables MyMenu
Application.CommandBars("Worksheet Menu Bar").Controls("MyMenu").Enabled = False
'Enables My Menu
Application.CommandBars(1).Controls("MyMenu").Enabled = True
'Here I am trying to disable a submenu item in the MyMenu menu, but I get a Runtime Error 5 Invalid procedure call or argument
Application.CommandBars("MyMenu").Controls("Minimize").Enabled = False
End Sub
Any help greatly appreciated.
I can disable the menu item itself on the Worksheet Menu Bar, but not the submenu items.
Public Sub test()
'Disables MyMenu
Application.CommandBars("Worksheet Menu Bar").Controls("MyMenu").Enabled = False
'Enables My Menu
Application.CommandBars(1).Controls("MyMenu").Enabled = True
'Here I am trying to disable a submenu item in the MyMenu menu, but I get a Runtime Error 5 Invalid procedure call or argument
Application.CommandBars("MyMenu").Controls("Minimize").Enabled = False
End Sub
Any help greatly appreciated.