assign macro to button programmatically

  • Thread starter Thread starter Zone
  • Start date Start date
Z

Zone

I have a button on my worksheet from the Forms toolbar. I know I can use
ActiveSheet.Buttons(1).Caption="My Text" to set the button's caption. But
how do I set the button's macro to sub SpeakMsg? Excel XP. Thanks, James
 
Hi Zone

Sub Macro1()
ActiveSheet.Shapes("Button 1").OnAction = "testB"
End Sub


--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
Back
Top