ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting the caption in a button control (https://www.excelbanter.com/excel-programming/319048-setting-caption-button-control.html)

Andy Dorph

setting the caption in a button control
 
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


Jim Cone

setting the caption in a button control
 
Andy,

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

Jim Cone
San Francisco, USA

"Andy Dorph" wrote in message
...
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



Don Guillett[_4_]

setting the caption in a button control
 
try
btn.Characters.Text = "Hi There"

--
Don Guillett
SalesAid Software

"Andy Dorph" wrote in message
...
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




Tom Ogilvy

setting the caption in a button control
 
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.

--
Regards,
Tom Ogilvy


"Don Guillett" wrote in message
...
try
btn.Characters.Text = "Hi There"

--
Don Guillett
SalesAid Software

"Andy Dorph" wrote in message
...
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






Andy Dorph

setting the caption in a button control
 
Jim:

Thank you. It worked.

"Jim Cone" wrote:

Andy,

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

Jim Cone
San Francisco, USA

"Andy Dorph" wrote in message
...
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





All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com