Several ways to do it, but I'd suggest a class for Animal and a collection for the classes
This is what clsAnimal could look like
Option Explicit
Public Enum eDiet
Omnivore = 1
Herbivore = 2
Carnivore = 3
End Enum
Public Enum eBlood
Hot = 1
Cold = 2
End Enum
Private m_Animal As String
Private m_Legs As Long
Private m_Diet As eDiet
Private m_Blood As eBlood
Property Let Animal(s As String)
m_Animal = s
End Property
Property Get Animal() As String
Animal = m_Animal
End Property
Property Let NumberOfLegs(n As Long)
m_Legs = n
End Property
Property Get NumberOfLegs() As Long
NumberOfLegs = m_Legs
End Property
Property Let Diet(d As eDiet)
m_Diet = d
End Property
Property Get Diet() As eDiet
Diet = m_Diet
End Property
Property Get DietStr() As String
DietStr = Array("omnivore", "herbivore", "carnivore")(m_Diet - 1)
End Property
Property Let Blood(b As eBlood)
m_Blood = b
End Property
Property Get Blood() As eBlood
Blood = m_Blood
End Property
Property Get BloodStr() As String
BloodStr = Array("hot blooded", "cold blooded")(m_Blood - 1)
End Property
Sub Dump()
Call MsgBox("The " & Animal & " is a " & BloodStr & " " & DietStr & " with " & NumberOfLegs & " legs", vbInformation + vbOKOnly, "Animals")
End Sub
And the main module that has the collection
Option Explicit
Public CollectionOfAnimals As Collection
Sub test()
Dim TheAnimal As clsAnimal
Dim v As Variant
Set CollectionOfAnimals = New Collection
Set TheAnimal = New clsAnimal
With TheAnimal
.Animal = "Person"
.NumberOfLegs = 2
.Diet = Omnivore
.Blood = Hot
End With
CollectionOfAnimals.Add TheAnimal, TheAnimal.Animal
Set TheAnimal = New clsAnimal
With TheAnimal
.Animal = "Cow"
.NumberOfLegs = 4
.Diet = Herbivore
.Blood = Hot
End With
CollectionOfAnimals.Add TheAnimal, TheAnimal.Animal
Set TheAnimal = New clsAnimal
With TheAnimal
.Animal = "Lion"
.NumberOfLegs = 4
.Diet = Carnivore
.Blood = Hot
End With
CollectionOfAnimals.Add TheAnimal, TheAnimal.Animal
Set TheAnimal = New clsAnimal
With TheAnimal
.Animal = "Snake"
.NumberOfLegs = 0
.Diet = Carnivore
.Blood = Hot
End With
CollectionOfAnimals.Add TheAnimal, TheAnimal.Animal
For Each v In CollectionOfAnimals
v.Dump
Next
MsgBox "A person has " & CollectionOfAnimals("Person").NumberOfLegs & " legs"
End Sub
There's no error checking for adding one that's already there for example
I would consider an .Add sub in the class to plop in all parameters at once
Some things to think on