Me Keyword represents
the current instance of the class in which code is executing.
Me is an implicit
reference to the current object as defined by the
Me is automatically
available to every procedure in a VBScript class.
In this example, a class method in a WSH script passes an
instance of itself to a function outside of the class by using the
Dim oCtr Set oCtr = New CCounter oCtr.Increment oCtr.Increment MsgBox "Count: " & oCtr.ShowCount ' definition of CCounter class Class CCounter Private lCtr Property Get Value Value = lCtr End Property Private Sub Class_Initialize( ) lCtr = 1 End Sub Public Sub Increment( ) lCtr = lCtr + 1 End Sub Public Function ShowCount( ) ShowCount = ShowObjectValue(Me) End Function End Class ' Show value of an object's Value property Public Function ShowObjectValue(oObj) ShowObjectValue = oObj.Value End Function
Values can’t be assigned to the
Me Keyword is
particularly useful when passing an instance of the current
class as a parameter to a routine outside of the class.