setting the caption in a button control

A

Andy Dorph

After entering the following line:
Set btn = ActiveSheet.Shapes.AddFormControl(xlButtonControl, 160, 28, 75,
23)

I try to change the caption by using

btn.Caption = "caption"

I receive an error when the code runs. What am I doing wrong? How can I
get this to work?

TIA
 
J

Jim Cone

Andy,

Try... btn.TextFrame.Characters.Text = "Caption"

Jim Cone
San Francisco, USA
 
T

Tom Ogilvy

That didn't work for me. Perhaps:

Sub Tester3()
Set btn = ActiveSheet.Shapes.AddFormControl(xlButtonControl, 160, 28, 75,
23)
ActiveSheet.Buttons(btn.Name).Caption = "Hi There"
End Sub

which did work.
 

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