Change caption of button in VB from range in sheet


Posted by alfredo sanchez on April 10, 2001 7:29 PM

Hi!
Please help me with this: Is it possible to assign the CAption of a button from within VB, gettin it from value stored in a cell?. I have tried but get 'object properties calling' error. Thanks .

Posted by Dave Hawley on April 10, 2001 8:09 PM

Hi alfredo


It sure is, try this

Dim OptCaption as String
OptCaption= Sheets("Sheet1").Range("A1")
OptionButton1.Caption= OptCaption

Dave
OzGrid Business Applications

Posted by alfredo sanchez on April 10, 2001 9:21 PM

Dave: I was thinking of assigning a macro to a button from name stored in cell. Can you help with that?


Posted by alfredo sanchez on April 10, 2001 9:22 PM

Dave: I was thinking of assigning a macro to a button from name stored in cell. Can you help with that?

Posted by Dave Hawley on April 10, 2001 9:40 PM

Re: Dave: I was thinking of assigning a macro to a button from name stored in cell. Can you help with that?

alfredo, this code is for assigning a macro to a CommandButton from the "Forms" toolbar.

Dim CmdBtnMacro as String
CmdBtnMacro = Sheets("Sheet1").Range("A1")
ActiveSheet.Shapes("Button 13").OnAction = CmdBtnMacro

Dave


OzGrid Business Applications



Posted by alfredo sanchez on April 10, 2001 9:59 PM

Re: Dave: THANK YOU VERY MUCH AND IVAN TOO!!!!!