Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default get Control of a Butoon placed in the Sheet

I have button placed on a sheet from "control toolbox"
I need to change the caption of the button thru code.

I found the following link at ozgrid . com
http://www.ozgrid.com/forum/showthread.php?t=74185

There I saw two approches, but both are failing for me.


I tried to test with following codes. These codes are in a Module.

Sub test1()
Set btn = Worksheets("Selection Sheet").Shapes("Button_Proceed")
MsgBox btn.OLEFormat.Object.Caption
End Sub

Sub test2()
MsgBox Worksheets("Selection
Sheet").Shapes("Button_Proceed").TextFrame.Charact ers.Text
End Sub


Both are returning run time errors..

Run-time Error '438'
Object doesn't support this property or method (Error 438)



can anyone help???

best regards
Joe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default get Control of a Butoon placed in the Sheet


I got it resolved...

ThisWorkbook.Worksheets("Selection
Sheet").OLEObjects("Button_Proceed").Object.Captio n = ObjNewText


thanks anyway
joe
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default get Control of a Butoon placed in the Sheet

Worksheets("Sheet1").CommandButton1.Caption = "hi there"
'or
Worksheets("Sheet1").OLEObjects("Commandbutton1"). Object.Caption = "bye there"

(change the sheet name to what you need)

Joe wrote:

I have button placed on a sheet from "control toolbox"
I need to change the caption of the button thru code.

I found the following link at ozgrid . com
http://www.ozgrid.com/forum/showthread.php?t=74185

There I saw two approches, but both are failing for me.

I tried to test with following codes. These codes are in a Module.

Sub test1()
Set btn = Worksheets("Selection Sheet").Shapes("Button_Proceed")
MsgBox btn.OLEFormat.Object.Caption
End Sub

Sub test2()
MsgBox Worksheets("Selection
Sheet").Shapes("Button_Proceed").TextFrame.Charact ers.Text
End Sub

Both are returning run time errors..

Run-time Error '438'
Object doesn't support this property or method (Error 438)

can anyone help???

best regards
Joe


--

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
Control of Sheet Tab functions? rick Excel Programming 2 September 28th 09 04:09 PM
Refer to a control name from another sheet rezafloyd Excel Programming 1 October 10th 06 09:26 AM
Control Sheet Cedrun Excel Worksheet Functions 2 October 4th 06 09:48 PM
For each control in sheet Claus[_3_] Excel Programming 3 May 15th 06 12:06 PM
Control End After the Sheet is Modified Paul Excel Discussion (Misc queries) 3 February 18th 05 05:12 PM


All times are GMT +1. The time now is 06:07 AM.

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"