163
reputation
9

Mathieu Guindon

About Me

Me is a reserved name (you can't have a variable by that name) that refers to something that can only exist at run-time in a procedure's scope: the current object. Under the hood, when you make a member call to DoSomething against a Class1 object, the call goes essentially like this:

Set obj = New Class1
Class1.DoSomething obj

This means DoSomething looks like this in VBA:

Public Sub DoSomething()
End Sub

But VBA sees it like this:

Public Sub DoSomething(ByVal Me As Class1)
End Sub

That makes Me an implicit locally-scoped ByVal parameter of type Class1, and inside the DoSomething scope it holds a reference to whatever object the caller is currently using.


Moderator on Code Review Stack Exchange, 2015-2018, 2019-
Microsoft MVP (Office Apps & Services), 2018-

Rubberduck
rubberduckvba.com | twitter | github | wordpress

3
answers
1
question
~348
people reached
  • Quebec
  • Member for 2 years, 8 months
  • 15 profile views
  • Last seen Mar 13 at 4:16

Top tags (4)

Score 4
Posts 4
Posts % 100
Score 3
Posts 2
Score 1
Posts 1
Score 0
Posts 1

Top posts (4) All Questions Answers | Votes Newest

Badges (9)

Gold

Silver

Bronze

9

Rarest