Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel XP & Win XP
I have a Control Toolbox button, "CommandButton1" with a caption of, say, "Old Caption". I want to change the caption via VBA to, say, "New Caption". How do I code that? Thanks for your time. Otto |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Userform1.Commandbutton1.caption="New Caption" Regards, Per "Otto Moehrbach" skrev i meddelelsen ... Excel XP & Win XP I have a Control Toolbox button, "CommandButton1" with a caption of, say, "Old Caption". I want to change the caption via VBA to, say, "New Caption". How do I code that? Thanks for your time. Otto |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Per
Thanks for your response but I don't have a UserForm. The button is a simple Control Toolbox button on the sheet. Otto "Per Jessen" wrote in message ... Userform1.Commandbutton1.caption="New Caption" Regards, Per "Otto Moehrbach" skrev i meddelelsen ... Excel XP & Win XP I have a Control Toolbox button, "CommandButton1" with a caption of, say, "Old Caption". I want to change the caption via VBA to, say, "New Caption". How do I code that? Thanks for your time. Otto |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim ole As OLEObject
On Error Resume Next Set ole = ActiveSheet.OLEObjects("CommandButton1") On Error GoTo 0 If Not ole Is Nothing Then ole.Object.Caption = "New Caption" Else msgbox "no oleObject named CommandButton1 on activesheet" End If Regards, Peter T "Otto Moehrbach" wrote in message ... Excel XP & Win XP I have a Control Toolbox button, "CommandButton1" with a caption of, say, "Old Caption". I want to change the caption via VBA to, say, "New Caption". How do I code that? Thanks for your time. Otto |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ActiveSheet.CommandButton1.Caption = "hi there"
'or ActiveSheet.OLEObjects("commandbutton1").Object.Ca ption = "bye now" Otto Moehrbach wrote: Excel XP & Win XP I have a Control Toolbox button, "CommandButton1" with a caption of, say, "Old Caption". I want to change the caption via VBA to, say, "New Caption". How do I code that? Thanks for your time. Otto -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Peter, Dave
Thanks. Works like a charm. Otto "Dave Peterson" wrote in message ... ActiveSheet.CommandButton1.Caption = "hi there" 'or ActiveSheet.OLEObjects("commandbutton1").Object.Ca ption = "bye now" Otto Moehrbach wrote: Excel XP & Win XP I have a Control Toolbox button, "CommandButton1" with a caption of, say, "Old Caption". I want to change the caption via VBA to, say, "New Caption". How do I code that? Thanks for your time. Otto -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Command Button from Control Toolbox | Excel Programming | |||
Control Toolbox button | Excel Discussion (Misc queries) | |||
Toggle change control button face id & caption | Excel Programming | |||
How to put a button made through Control Toolbox | Excel Programming | |||
Control Toolbox button | Excel Programming |