BAH said:
Hi
Is there a way to create a macrobutton that enables me,
when double-clicking it, to toggle between two macros already created?
Buttons also have a State property, that determines whether they look
"pressed" or "depressed".
You could have one macro that checks out the State, runs the appropriate
code, and toggles the button to the other State.
Sub TestState()
Dim myCBB As CommandBarButton
Set myCBB = CommandBars.ActionControl
Select Case myCBB.State
Case msoButtonDown
MsgBox "run code to lift the button"
myCBB.State = msoButtonUp
Case msoButtonUp
MsgBox "run code to press the button"
myCBB.State = msoButtonDown
Case msoButtonMixed
MsgBox "shouldn't happen"
myCBB.State = msoButtonDown
End Select
End Sub
Klaus