I am trying to sort and array of UDTs using a sub but I get the follow error. Does anybody know what I am doing wrong?
"Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types"
My main code is different module calling the SortUserInfo subCode:Type UserInformation UserID As String * 16 UserName As String OSName As String OSDomain As String EmailAddress As String End Type Public Sub SortUserInfo(UserArray As Variant) Dim i As Integer Dim SortFlag As Boolean Dim TempUserInfo As UserInformation SortFlag = False While SortFlag = False SortFlag = True For i = 0 To UBound(UserArray) - 1 If LCase(UserArray(i).UserName) > LCase(UserArray(i + 1).UserName) Then TempUserInfo = UserArray(i) UserArray(i) = UserArray(i + 1) UserArray(i + 1) = TempUserInfo SortFlag = False End If Next i Wend End Sub
Code:Dim UserInfo() As UserInformation SortUserInfo (UserInfo)




Reply With Quote