Is it possible to view the members/properties of a Class within the Locals window?
When I try to view the values, the Locals window simply states "Object doesn't support this property or method."
Is there some adjustment I need to make to my Classes in order for the members/properties to be visible in the Locals window?
Here is a basic example of how I am creating a class (using a Class, an Interface and a Factory):
My Class called: "clsMyClass"
Option Explicit
Implements IMyClass
Private Type TMyClass
MyID As Long
MyName As String
End Type
Private This As TMyClass
Private Property Get IMyClass_MyID() As Long
IMyClass_MyID = This.MyID
End Property
Private Property Get IMyClass_MyName() As String
IMyClass_MyName = This.MyName
End Property
Private Function IMyClass_ChangeMyID(NewID As Long) As Long
IMyClass_ChangeMyID = This.MyID
This.MyID = NewID
End Function
Private Function IMyClass_ChangeMyName(NewMyName As String) As String
IMyClass_ChangeMyName = This.MyName
This.MyName = NewMyName
End Function
Public Sub FillData( _
MyID As Long, _
MyName As String _
)
This.MyID = MyID
This.MyName = MyName
End Sub
My Interface: IMyClass
Public Property Get MyID() As Long
End Property
Public Property Get MyName() As String
End Property
Public Function ChangeMyID(NewID As Long) As Long
End Function
Public Function ChangeMyName(NewMyName As String) As String
End Function
My Class Factory: "MyClassFactory"
Option Explicit
Public Function Create( _
MyID As Long, _
MyName As String _
) As IMyClass
Dim newMyClass As clsMyClass
Set newMyClass = New clsMyClass
newMyClass.FillData MyID, MyName
Set Create = newMyClass
End Function
My Test sub:
Public Sub test()
Dim myTestClass As IMyClass
Set myTestClass = MyClassFactory.Create(1, "Some Name")
End Sub
If I put a break point after myTestClass is created, this is what my Locals window displays:
If I Debug.Print myTestClass.MyID it prints the correct value in the Immediate window. But it would be nice to be able to explore my entire Class at a break point without having to manually print all of the values. Is this possible with VBA? If so, what do I need to change?