I use this for combo boxes, maybe you can adapt it to suit your needs:
calling procedure:
Dim vSort() As Variant
'sort combo box
vSort = Sort_Combo(cComboBox.List)
cComboBox.List = vSort
'Assumptions:
'Combo box passed in array of variants (0 to #, 0 to 9), with
'vArray(#,0) as the item to sort by
'
Public Function Sort_Combo(vArray As Variant) As Variant
Dim u As Long, l As Long, I As Long
Dim vTemp() As Variant
Dim vA As Variant, vB As Variant
Dim bSort As Boolean
bSort = False
vTemp = vArray
u = UBound(vArray, 1): l = LBound(vArray, 1)
Do
bSort = False
For I = l To u - 1
If vTemp(I, 0) <= vTemp(I + 1, 0) Then
'Debug.Print vTemp(i, 0) & " vs " & vTemp(i + 1, 0)
'this situation is ok
Else
'need to swap
bSort = True
vA = vTemp(I, 0)
vB = vTemp(I + 1, 0)
vTemp(I, 0) = vB
vTemp(I + 1, 0) = vA
'Debug.Print "chg'd " & vTemp(i, 0) & " w/ " & vTemp(i + 1,
0)
End If
Next
Loop Until bSort = False
Sort_Combo = vTemp
End Function
' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . .
--
Kevin
"William Jimenez" wrote in message
news:f13bcd3.-1@WebX.maYIadrTaRb...
> Does anyone have some code to sort list boxes in Autocad's VBA?
>
> Thanks for your help
>
>