Hi All,
I have a module that is trying to store classes in a collection based off selections in a userform and I'm a little stuck. For illustrative purposes I've simplified it.
MainTest is my main module
fTest is the userform (that contains a text box (tbName) and and two command buttons (cbRun and cbClose))
cTest is the class
The problem I face is that the classes aren't added to the collection as it's not 'in' the userform. Can you pass the collection to the userform as I would a function? Or any other help would be greatly appreciated.
Thanks in advance.
I have a module that is trying to store classes in a collection based off selections in a userform and I'm a little stuck. For illustrative purposes I've simplified it.
MainTest is my main module
Code:
Sub MainTest()
Dim colTest As New Collection
fTest.Show
..Does stuff with the elements in the collection..
End Sub
fTest is the userform (that contains a text box (tbName) and and two command buttons (cbRun and cbClose))
Code:
Private Sub cbRun_Click()
Dim cPerson as New cTest
cPerson.Name = fTest.tbName.value
colTest.add cPerson
End Sub
Private Sub cbClose_Click()
fTest.hide
End Sub
cTest is the class
Code:
Private pName As String
Property Let Name(value As String)
pName = value
End Property
Property Get Name() As String
Name = pName
End Property
The problem I face is that the classes aren't added to the collection as it's not 'in' the userform. Can you pass the collection to the userform as I would a function? Or any other help would be greatly appreciated.
Thanks in advance.