73,556
reputation
3
87
230

Mathieu Guindon
Moderator

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

258
answers
87
questions
~115k
people reached

Top tags (99)

Score 2,320
Posts 307
Posts % 89
Score 284
Posts 22
Score 253
Posts 29
Score 240
Posts 36
Score 227
Posts 60
Score 185
Posts 29

Top posts (345)

View all questions and answers

Badges (320)

Gold

3

Rarest

Silver

87

Rarest

Bronze

230

Rarest