5,480
reputation
2
22
50

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

27
answers
35
questions
~48k
people reached

Top tags (86)

Score 256
Posts 24
Posts % 39
Score 64
Posts 16
Score 57
Posts 13
Score 40
Posts 6
Score 29
Posts 11
Score 29
Posts 5

Top posts (62) All Questions Answers | Votes Newest

View all questions and answers

Badges (74)

Gold

2

Rarest

Silver

22

Rarest

Bronze

50

Rarest