CARVIEW |
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsAbout 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-2022
-
ReversalSep 3, 2015
-
discussionJun 19, 2021
-
ElectorateJan 6, 2016
-
LifejacketJun 18, 2019
-
TaxonomistAug 1, 2016
-
Strunk & WhiteNov 21, 2018
-
asking-questionsDec 17, 2017
-
scopeAug 16, 2016
-
specific-questionApr 18, 2016