M
Madla
I'm trying to change the checkmark (.state) of a submenu in a menu that
I've added to the "Menu bar". (I added the submenu entries to the a
CommandBarPopup with CommandBarButtons.)
The Menu builds as expected but when I execute the following code within
a sub routine triggerted from the menu's action I can't figure out how
to turn the commandbarControl into a commandbarbutton so I can change
it's shape.
dim ctl as CommandBarControl 'I tried as CommandBarButton and
CommandBarPopup
Set myPopup = CommandBars("Menu bar").Controls(cIAMenu)
For Each
ctl In myPopup.Controls
'remove check next to menu item
ctl.State = msoButtonUp
Next
I get the following error, which I understand, as a CommandBarControl
doesn't have a .state property.
Error 438 - object doesn't support this method or property
So the question is how do I get a CommandBarButton so I can set its
state?
Interestingly enough this line works, even though I thought it also
returns a commandBarControl.
CommandBars.ActionControl.State =
msoButtonDown
Any help would be appreciated...martin
I've added to the "Menu bar". (I added the submenu entries to the a
CommandBarPopup with CommandBarButtons.)
The Menu builds as expected but when I execute the following code within
a sub routine triggerted from the menu's action I can't figure out how
to turn the commandbarControl into a commandbarbutton so I can change
it's shape.
dim ctl as CommandBarControl 'I tried as CommandBarButton and
CommandBarPopup
Set myPopup = CommandBars("Menu bar").Controls(cIAMenu)
For Each
ctl In myPopup.Controls
'remove check next to menu item
ctl.State = msoButtonUp
Next
I get the following error, which I understand, as a CommandBarControl
doesn't have a .state property.
Error 438 - object doesn't support this method or property
So the question is how do I get a CommandBarButton so I can set its
state?
Interestingly enough this line works, even though I thought it also
returns a commandBarControl.
CommandBars.ActionControl.State =
msoButtonDown
Any help would be appreciated...martin