From: MM on
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
> 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
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
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
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
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: Graphic Draw Question
Next: Redirection