Removing Picture from Cell Command Bar
Rick,
After you've added the control to the Cell commandbar, you can change it by addressing it this way:
With Application.CommandBars("Cell").Controls("Alpha Sort Asc")
Sheet1.Shapes(btnOtherTick).CopyPicture
.PasteFace
.Enabled = True
End With
Where, obviously, btnOtherTick is a variable containing the name of a valid shape object on Sheet1.
HTH,
Bernie
Excel MVP
"Rick De Marco" wrote in message om...
Hi,
I have a small problem and I was wondering if anyone could help. I am
using the following code to add new buttons to the right click menu
With Application.CommandBars("Cell").Controls.Add(msoCo ntrolButton,
temporary:=True)
Sheet1.Shapes(btnTick).CopyPicture
.PasteFace
.Enabled = False
.Caption = "Alpha Sort Asc"
End With
This all works fine and I get a new menu item with the associated
picture. The affect I am trying to make is - when a user right clicks
on a cell and select one on my menu items I want to put a tick next to
it, which I can do fine. My problem is that when a user selects a
different menu item i then need to remove the picture from the
previously selected item and move it to the newly selected. Can anyone
tell me how I can remove the picture without deleting the menu item
and adding it again? Basically I am trying to hide the picture if the
menu item is not selected and make it visible if it is selected.
Thanks,
Rick
|