user avatar
user avatar
user avatar
Mathieu Guindon
  • Member for 9 years, 1 month
  • Last seen more than a week ago
Stats
74,554
reputation
4.0m
reached
867
answers
157
questions
Loading…
About

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 (retired) on Code Review Stack Exchange, 2015-2021
Microsoft MVP (Office Apps & Services), 2018-

Rubberduck
rubberduckvba.com | twitter | github | wordpress

17
gold badges
184
silver badges
454
bronze badges
2,987
Score
559
Posts
55
Posts %
1,285
Score
281
Posts
27
Posts %
763
Score
155
Posts
15
Posts %
538
Score
56
Posts
5
Posts %
416
Score
79
Posts
8
Posts %
407
Score
72
Posts
7
Posts %
Top posts
View all questions and answers
question
124
Aug 29, 2014
answer
61
Apr 27, 2016
question
50
Oct 13, 2013
question
44
Dec 8, 2014
answer
42
Aug 15, 2015
question
40
Oct 15, 2014