ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change CommandButton Caption (https://www.excelbanter.com/excel-programming/304245-change-commandbutton-caption.html)

Claude

Change CommandButton Caption
 
Hi

Does anyone know how to change the text on a command
button? The following does not work:

ActiveSheet.Shapes("CommandButton1").Caption = "test"

Chip Pearson

Change CommandButton Caption
 
Claude,

Try the following:

ActiveSheet.Buttons("Button 1").Caption = "test"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Claude" wrote in message
...
Hi

Does anyone know how to change the text on a command
button? The following does not work:

ActiveSheet.Shapes("CommandButton1").Caption = "test"




Tom Ogilvy

Change CommandButton Caption
 
ActiveSheet.OleObjects.("CommandButton1").Object.C aption = "test"

--
Regards,
Tom Ogilvy

"Claude" wrote in message
...
Hi

Does anyone know how to change the text on a command
button? The following does not work:

ActiveSheet.Shapes("CommandButton1").Caption = "test"




Lisa Norgaard

Change CommandButton Caption
 
"Claude" wrote in message ...
Hi

Does anyone know how to change the text on a command
button? The following does not work:

ActiveSheet.Shapes("CommandButton1").Caption = "test"


Try this:

ActiveSheet.CommandButton1.Caption = "test"

Claude

Change CommandButton Caption
 
Hi Lisa

This one worked! Thanks

-----Original Message-----
"Claude" wrote in

message ...
Hi

Does anyone know how to change the text on a command
button? The following does not work:

ActiveSheet.Shapes("CommandButton1").Caption = "test"


Try this:

ActiveSheet.CommandButton1.Caption = "test"
.



All times are GMT +1. The time now is 01:26 PM.

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