How can I sort an array() ?
Posted by Bruno on December 03, 2001 2:14 AM
Hello,
How can I sort the array maps() in the following example ?
kinds regards,
Bruno
==============
Sub SortMaps()
Dim maps(100) As Variant
' Display the names in C:\ that represent directories.
MyPath = "c:\" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
counter = 1
Do While MyName <> ""
If MyName <> "." And MyName <> ".." Then
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
maps(counter) = MyName
counter = counter + 1
End If
End If
MyName = Dir 'next entry
Loop
'result
For dummy = 1 To counter - 1
MsgBox maps(dummy), vbOKOnly, "One by one...(not sorted)"
Next
End Sub