MichaelOar
New Member
- Joined
- Oct 13, 2008
- Messages
- 5
Hello,
Can't find an answer that's working for me. I need to programatically add a button, rename the button text and link to a macro. I got what I thought was the hard stuff (macro assignment, button creation, placement, etc), but I can't for the life of me figure out how to NAME the thing. There is a Shape.Name attribute, but this doesn't seem to change the text displayed on the button. Other posts I've seen have said to use the "Caption" attribute for buttons and/or to use "command buttons". When I use the VBA help and look at the examples I can find on the web, they tell me to do something like this:
Dim myButton As Shape
With Worksheets(mySheet.Name)
Set myButton = .Shapes.AddFormControl(xlButtonControl, 50, 325, 80, 60)
End With
Again, can't find a way to set the button text/name. I tried:
myButton.Name = "My Name"
but that isn't working.
Any help would be greatly appreciated.
-Mike
Can't find an answer that's working for me. I need to programatically add a button, rename the button text and link to a macro. I got what I thought was the hard stuff (macro assignment, button creation, placement, etc), but I can't for the life of me figure out how to NAME the thing. There is a Shape.Name attribute, but this doesn't seem to change the text displayed on the button. Other posts I've seen have said to use the "Caption" attribute for buttons and/or to use "command buttons". When I use the VBA help and look at the examples I can find on the web, they tell me to do something like this:
Dim myButton As Shape
With Worksheets(mySheet.Name)
Set myButton = .Shapes.AddFormControl(xlButtonControl, 50, 325, 80, 60)
End With
Again, can't find a way to set the button text/name. I tried:
myButton.Name = "My Name"
but that isn't working.
Any help would be greatly appreciated.
-Mike