get Control of a Butoon placed in the Sheet

J

Joe

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.Characters.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
 
J

Joe

I got it resolved...

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


thanks anyway
joe
 
D

Dave Peterson

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

(change the sheet name to what you need)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top