You could just store the list to a Listbox who's Sorted property is set to True, or you could write a simple sort routine yourself, i.e.
Code:
Private Sub Command1_Click()
Dim aFiles() As String
Dim sDir As String
Dim nFile As Long
ReDim aFiles(0)
sDir = Dir("*.*")
While Len(sDir)
aFiles(UBound(aFiles)) = sDir
ReDim Preserve aFiles(UBound(aFiles) + 1)
sDir = Dir
Wend
ReDim Preserve aFiles(UBound(aFiles) - 1)
SortList aFiles
For nFile = 0 To UBound(aFiles)
'Do whatever with each file here.
Debug.Print aFiles(nFile)
Next
End Sub
Private Sub SortList(ByRef aList As Variant)
Dim sTemp As String
Dim nIndex As Long
'Simple Sort Routine
nIndex = 1
While nIndex < UBound(aList)
If UCase(aList(nIndex)) < UCase(aList(nIndex - 1)) Then
sTemp = aList(nIndex - 1)
aList(nIndex - 1) = aList(nIndex)
aList(nIndex) = sTemp
nIndex = nIndex - 1
Else
nIndex = nIndex + 1
End If
Wend
End Sub
[Edited by Aaron Young on 05-22-2000 at 03:14 PM]