2
How do I pass an Array as a parameter to a function in VBA? Detail if I define a type of variable like String, Integer, etc... works, however a type defined by me, does not work! For example:
Type pessoa
nome As String
idade As Integer
End Type
Public Sub SomaIdade(arrPessoa As Variant)
Dim soma As Integer
For i = 0 To UBound(arrPessoa)
soma = som + arrPessoa(i)
Next i
Debug.Print (soma)
End Sub
Sub main()
Dim p(2) As pessoa
p(0).idade = 10
p(1).idade = 20
p(2).idade = 30
SomaIdade (p)
End Sub
I did some research and it seems that there is no way.
– Augusto Vasques