Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Change Control Toolbox Button Caption

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Change Control Toolbox Button Caption



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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Change Control Toolbox Button Caption

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Change Control Toolbox Button Caption

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Change Control Toolbox Button Caption

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Change Control Toolbox Button Caption

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Button from Control Toolbox Jim May Excel Programming 2 July 1st 06 06:03 PM
Control Toolbox button PBS Excel Discussion (Misc queries) 1 March 21st 06 11:39 PM
Toggle change control button face id & caption mikeburg[_2_] Excel Programming 1 June 25th 05 03:00 AM
How to put a button made through Control Toolbox jose luis Excel Programming 0 May 25th 05 12:17 AM
Control Toolbox button david Excel Programming 0 August 5th 03 05:28 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"