Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change caption of a button | Excel Worksheet Functions | |||
Toggle change control button face id & caption | Excel Programming | |||
How to change Button Caption? | Excel Programming | |||
Change caption on a macro button | Excel Worksheet Functions | |||
Change Caption of Forms Command Button | Excel Programming |