'I need to know the correct syntax for passing
'BYREF a 2 dimentional array defined with a
'TYPE to a subroutine. I need to pass it by
'reference rather than define it as public.
'Thanks.
'
'BYREF a 2 dimentional array defined with a
'TYPE to a subroutine. I need to pass it by
'reference rather than define it as public.
'Thanks.
'
Code:
Option Explicit
Type Information
sSex As String
sName As String
sAddress As String
End Type
Private Sub Initialize_Array()
Dim aiPeople(2, 2) As Information
aiPeople(1, 1).sSex = "Male"
aiPeople(1, 1).sName = "John"
aiPeople(1, 1).sAddress = "Apartment 101"
'This next line does not work;
'The error message that I get is:
' "ByRef type argument mismatch"
Display_Information ((aiPeople))
End Sub
Private Sub Display_Information(ByRef aiCouple As Information)
Dim iRow As Integer
Dim iCol As Integer
For iRow = 1 To 2
For iCol = 1 To 2
MsgBox aiCouple(iRow, iCol)
Next J
Next I
End Sub
'