Prev: Graphic Draw Question
Next: Redirection
From: MM on 2 Mar 2010 12:27 Suppose I have: Sub AnyProc (cbo as ComboBox) MsgBox cbo.Name End Sub With Combo1 AnyProc ? End With How can I refer to the object itself to pass to AnyProc? What I need is a .Self property! MM
From: Rick Rothstein on 2 Mar 2010 12:51 > Suppose I have: > > Sub AnyProc (cbo as ComboBox) > MsgBox cbo.Name > End Sub > > With Combo1 > AnyProc ? > End With > > How can I refer to the object itself to pass to AnyProc? What I need > is a .Self property! Interesting question. You could, of course, just use Combo1 since you know it is Combo1; however, a general approach (assuming the With statement was using an object variable as opposed to a hard-coded control name) might be this... AnyProc Controls(.Name) -- Rick (MVP - Excel)
From: Karl E. Peterson on 2 Mar 2010 12:58 MM wrote: > Suppose I have: > > Sub AnyProc (cbo as ComboBox) > MsgBox cbo.Name > End Sub > > With Combo1 > AnyProc ? > End With > > How can I refer to the object itself to pass to AnyProc? What I need > is a .Self property! Unfortunately, the only way is by name. -- ..NET: It's About Trust! http://vfred.mvps.org
From: Eduardo on 2 Mar 2010 15:11 Rick Rothstein escribi�: >> Suppose I have: >> >> Sub AnyProc (cbo as ComboBox) >> MsgBox cbo.Name >> End Sub >> >> With Combo1 >> AnyProc ? >> End With >> >> How can I refer to the object itself to pass to AnyProc? What I need >> is a .Self property! > > Interesting question. You could, of course, just use Combo1 since you > know it is Combo1; however, a general approach (assuming the With > statement was using an object variable as opposed to a hard-coded > control name) might be this... > > AnyProc Controls(.Name) > Yep. And if the procedure is not in the (same) form: .Parent.Controls (.Name)
From: MM on 2 Mar 2010 15:37
On Tue, 2 Mar 2010 12:51:08 -0500, "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote: >> Suppose I have: >> >> Sub AnyProc (cbo as ComboBox) >> MsgBox cbo.Name >> End Sub >> >> With Combo1 >> AnyProc ? >> End With >> >> How can I refer to the object itself to pass to AnyProc? What I need >> is a .Self property! > >Interesting question. You could, of course, just use Combo1 since you know >it is Combo1; however, a general approach (assuming the With statement was >using an object variable as opposed to a hard-coded control name) might be >this... > >AnyProc Controls(.Name) Ah, I tried everything else, but not that! Don't you think a ".Self" property would have been useful? Like Me. MM |