New to building class modules in VBA and struggling with populating one object which is defined within another object.
For instance, I have two class modules, Class1 and Class2
Class1
Dim mobj As Class2
Public Property Set SetObj(obj As Class2)
Set mobj = obj
End Property
Class2
Public FirstName As String
These are accessed from a standard module as follows:
Sub test()
Dim X As Class1
Set X = New Class1
Set X.SetObj = New Class2
X.SetObj.FirstName = "Bruce"
End Sub
This however fails in X.SetObj.FirstName = "Bruce" when i get an "Invalid use of property message". Any assistance would be greatly appreciated.