When using a Class Module in VBA, how come a call to a Private Sub
will fail when using Me
in front of it, but a call to a Public Sub
is OK?
For example, the code below (not a full Class Module, just a snippit) produces the error Method or data member not found
or the line Call Me.SetupQuote
.
However, if I make SetupQuote()
a Public Sub
all is fine. Surely when a Class Module is calling from within itself it shouldn't matter if the sub is public or private?
I realise I can just call a Private Sub
without using Me
, but I want to understand why VBA behaves in this way. Thanks.
Private Sub Class_Initialize()
Me.QuoteID = 15
Call Me.SetupQuote
End Sub
Private Sub SetupQuote()
Set Quote = New classQuote
Call Quote.SetQuote(Me.QuoteID)
End Sub