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

Hi,

I just added a button to one of my worksheets this way:

ActiveSheet.Buttons.Add(100, 300, 180, 15)

Now I would like to change the caption of the button, but don't know how to
do it. Help and MSDN-Reference don't cover this object or I cannot find it.

I can add an event to my buttons, but cannot change the caption...

ActiveSheet.Shapes(3).OnAction = "SwitchTo_"
ActiveSheet.Shapes(3).Name = "Caption" ' doesn't work

Any suggestions?

Many thanks
Alex

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Change Caption of Button

Use

ActiveSheet.Shapes(3).Caption = "Caption"

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Alexander" wrote in message ...
Hi,

I just added a button to one of my worksheets this way:

ActiveSheet.Buttons.Add(100, 300, 180, 15)

Now I would like to change the caption of the button, but don't know how to
do it. Help and MSDN-Reference don't cover this object or I cannot find it.

I can add an event to my buttons, but cannot change the caption...

ActiveSheet.Shapes(3).OnAction = "SwitchTo_"
ActiveSheet.Shapes(3).Name = "Caption" ' doesn't work

Any suggestions?

Many thanks
Alex



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Change Caption of Button

Hi Alexander,

Here's one way - name the button as you create it:

Sheet1.Buttons.Add(100, 300, 180, 15).Name = "btnTest"
Sheet1.Buttons("btnTest").Caption = "Test"

If you want to access the button from the Shapes collection, I think you'll
have to use this method:

ActiveSheet.Shapes(3).OLEFormat.Object.Caption = "Test"

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Alexander wrote:
Hi,

I just added a button to one of my worksheets this way:

ActiveSheet.Buttons.Add(100, 300, 180, 15)

Now I would like to change the caption of the button, but don't know
how to do it. Help and MSDN-Reference don't cover this object or I
cannot find it.

I can add an event to my buttons, but cannot change the caption...

ActiveSheet.Shapes(3).OnAction = "SwitchTo_"
ActiveSheet.Shapes(3).Name = "Caption" ' doesn't work

Any suggestions?

Many thanks
Alex


  #4   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Change Caption of Button

Try this:

Sub test()
With ActiveSheet.Buttons.Add(100, 300, 180, 15)
.Caption = "whatever"
End With
End Sub



"Alexander" wrote:

Hi,

I just added a button to one of my worksheets this way:

ActiveSheet.Buttons.Add(100, 300, 180, 15)

Now I would like to change the caption of the button, but don't know how to
do it. Help and MSDN-Reference don't cover this object or I cannot find it.

I can add an event to my buttons, but cannot change the caption...

ActiveSheet.Shapes(3).OnAction = "SwitchTo_"
ActiveSheet.Shapes(3).Name = "Caption" ' doesn't work

Any suggestions?

Many thanks
Alex

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
Change caption of a button Dylan @ UAFC[_2_] Excel Worksheet Functions 3 November 25th 08 07:04 PM
Toggle change control button face id & caption mikeburg[_2_] Excel Programming 1 June 25th 05 03:00 AM
How to change Button Caption? BrianB Excel Programming 3 June 1st 05 06:24 PM
Change caption on a macro button gbeard Excel Worksheet Functions 3 April 21st 05 01:43 PM
Change Caption of Forms Command Button No Name Excel Programming 9 December 10th 04 07:59 AM


All times are GMT +1. The time now is 11:45 AM.

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

About Us

"It's about Microsoft Excel"