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
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
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.
- Code Review♦ 73.4k 73.4k 1717 gold badges175175 silver badges443443 bronze badges
- Stack Overflow 62k 62k 77 gold badges8383 silver badges194194 bronze badges
- Meta Stack Exchange 7.5k 7.5k 22 gold badges2626 silver badges5050 bronze badges
- Software Engineering 1.6k 1.6k 1414 silver badges3030 bronze badges
- Database Administrators 864 864 11 gold badge66 silver badges1212 bronze badges
- View network profile
Top network posts
- 119 Down with FizzBuzz... LOL
- 95 Is VBA an OOP language, and does it support polymorphism?
- 61 Interview coding test: Fizz Buzz
- 54 Implementing String.Format() in VB6
- 53 Unit of Work and Repository with Entity Framework 6
- 53 Are there disadvantages in putting code into Userforms instead of modules?
- 52 What are the fantasy secret hats you'd wish to get?
- View more network posts →