Multiple toolbar buttons executing one macro

J

JJ

I have multiple buttons on a toolbar (not on a form) (MS Project 2007) that I want to fire off one macro.

I want this macro to read the Text of the button that was pressed and pass that text value to another macro which will "do something" based on the button text.

So it would be something like this...
Button 1 Text: "Red"
Button 2 Text: "Yellow"
Button 3 Text: "Green"

Public Sub Button_Pressed

Dim ButtonText as string

ButtonText = <Text/Caption of Button that was pressed>

DoSomething ButtonText

End Sub

Public Sub DoSomething (SomeText as string)

<Do something based on value of SomeText>

End Sub

Does anyone know if this is possible? If so, please help me out with the code because I'm not sure how this could be done.

Thanks in advance!
JJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top