You can define your own variable type using code, for example:
Public T_Person as Type
name as string
dateOfBirth as date
....
email() as string (*)
....
End type
You can then declare the type T_person in your code with:
Dim currentPerson as T_Person
currentPerson.name = myName
currentPerson.dateOfBirth = myDate
currentPerson.email(1) = myFirstEmail
....
(*) I don’t remember the details for declaring arrays in such circumstances. When defining a variable, you may need to determine the length of the array. Please check the help.
, , , "". (, name, dateOfBirth ..), ( ). . :
Dim myPerson as Person
set myPerson = New Person
myPerson.name = myName
myPerson.dateOfBirth = myDate
if myPerson.age > 18 then (*)
'the guy is an adult'
myPerson.createAccount
Else
'the guy is not ...'
Endif
(*) - , , dateOfBirth . , google " VBA", VBA.
, "" (, ), (, "" ) "", VBA. : ( ) ( ). :
Public myPersons as Persons 'at the app level, 1 main collection'
myPersons.add .... 'adding a new person to your collection'
myPersons.count ... 'counting number of persons in myPersons'
, Google " VBA" VBA. , " " VBA.
"" , , "". , . !
PS: , myPersons myPerson Person. , "PersonCollection" "Person", "Individual"