Have you tried using a Collection Class?
Code:
'Form=========================
Option Explicit
Private Sub Form_Load()
Dim oCmp As Company
Dim oPer As Person
Dim i As Long
Set oCmp = New Company
'build the company
For i = 1 To 10
Set oPer = New Person
oPer.Name = "FullName " & i 'build a new person
oPer.SurName = "Surname " & i
oCmp.Add oPer 'add the person to the company
Next
'now enumerate persons in the company
For Each oPer In oCmp
Debug.Print oPer.Name, oPer.SurName
Next
' another way
For i = 1 To oCmp.Count
Debug.Print oCmp.Item(i).Name, oCmp.Item(i).SurName
Next
End Sub
'class Person=======================
Option Explicit
'change to properties to allow data validation
Public Name As String
Public SurName As String
'class Company===============================
Option Explicit
Private mCol As Collection
Public Sub Add(Obj As Person, Optional sKey As String)
If Len(sKey) = 0 Then
mCol.Add Obj
Else
mCol.Add Obj, sKey
End If
End Sub
Public Property Get Count() As Long
Count = mCol.Count
End Property
Public Sub Remove(vntIndexKey As Variant)
mCol.Remove vntIndexKey
End Sub
Public Property Get Item(vntIndexKey As Variant) As Person
Set Item = mCol.Item(vntIndexKey)
End Property
Public Property Get NewEnum() As IUnknown
'Tools|Procedure|Advanced
'Change Procedure ID to -4
'Allows For Each construct
Set NewEnum = mCol.[_NewEnum]
End Property
Private Sub Class_Initialize()
Set mCol = New Collection
End Sub
Private Sub Class_Terminate()
Set mCol = Nothing
End Sub