Here is code using the API.

I've tested this code against using FSO and using the Dir function. This code is much faster than the other two methods.

Copy it into a class module. There is a function to return all
results in an array and one to populate a listbox. Let me know what you think.

VB Code:
  1. Option Explicit
  2.  
  3. 'Originally taken from Rick Meyer at [url]http://pages.about.com/vbmakai/getfiles.htm[/url]
  4. 'Code Greatly Modified by Mike Rossi
  5.  
  6. '==========================================
  7. ' These are the API declarations needed for
  8. '   the file searching operations
  9. '==========================================
  10. Const FILE_ATTRIBUTE_NORMAL = &H80
  11. Const FILE_ATTRIBUTE_HIDDEN = &H2
  12. Const FILE_ATTRIBUTE_SYSTEM = &H4
  13. Const FILE_ATTRIBUTE_DIRECTORY = &H10
  14.  
  15. Private Type FILETIME
  16.   dwLowDateTime     As Long
  17.   dwHighDateTime    As Long
  18. End Type
  19.  
  20. Private Type WIN32_FIND_DATA
  21.   dwFileAttributes  As Long
  22.   ftCreationTime    As FILETIME
  23.   ftLastAccessTime  As FILETIME
  24.   ftLastWriteTime   As FILETIME
  25.   nFileSizeHigh     As Long
  26.   nFileSizeLow      As Long
  27.   dwReserved0       As Long
  28.   dwReserved1       As Long
  29.   cFileName         As String * 260
  30.   cAlternate        As String * 14
  31. End Type
  32.  
  33. Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" ( _
  34.     ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
  35.    
  36. Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" ( _
  37.     ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
  38.  
  39. Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
  40.  
  41. '==========================================
  42. ' These are the API declarations needed for
  43. '   adding the listbox horizontal scrollbar
  44. '==========================================
  45. Const LB_SETHORIZONTALEXTENT = &H194
  46.  
  47. Private Declare Function SendMessageByNum Lib "user32" Alias "SendMessageA" ( _
  48.     ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  49.  
  50. Dim maxWdth As Long
  51.  
  52. Public Sub arrayGetAllFiles(ByVal strDir As String, ByVal Extension As String, ByRef Results() As String, Optional NumFound As Long)
  53.    
  54. Dim fPath$, fName$, fPathName$
  55. Dim hfind&, nameLen%, matchLen%
  56. Dim WFD As WIN32_FIND_DATA
  57. Dim found As Boolean
  58.  
  59.   fPath = strDir
  60.   If Right(fPath, 1) <> "\" Then
  61.     fPath = fPath & "\"
  62.   End If
  63.    
  64.   matchLen = Len(Extension)
  65.   Extension = LCase$(Extension)
  66.  
  67.   'The first API call is FindFirstFile
  68.   hfind = FindFirstFile(fPath & "*", WFD)
  69.   found = (hfind > 0)
  70.  
  71.   Do While found
  72.  
  73.     fName = TrimNull(WFD.cFileName)
  74.     nameLen = Len(fName)
  75.     fPathName = fPath & fName
  76.    
  77.     If fName = "." Or fName = ".." Then
  78.  
  79.     ElseIf WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY Then arrayGetAllFiles fPathName, Extension, Results(), NumFound
  80.        
  81.     ElseIf matchLen > nameLen Then
  82.    
  83.     ElseIf LCase$(Right$(fName, matchLen)) = Extension Then
  84.       ReDim Preserve Results(NumFound)
  85.       Results(NumFound) = fPathName
  86.       NumFound = NumFound + 1
  87.     End If
  88.    
  89.     'Subsequent API calls to FindNextFile
  90.     found = FindNextFile(hfind, WFD)
  91.    
  92.   Loop
  93.  
  94.   'Then close the findfile operation
  95.   FindClose hfind
  96.  
  97. End Sub
  98.  
  99. Public Sub lstBoxGetCurrentDir(ByVal strDir As String, ByVal Extension As String, FormName As Form, ListBoxName As ListBox, Optional NumFound As Long, Optional ResetMaxWidth As Boolean = True)
  100.  
  101. Dim fName As String
  102. Dim fFile As String
  103.  
  104.   If ResetMaxWidth = True Then maxWdth = 0
  105.  
  106.   fName = Dir(strDir & "*." & Extension)
  107.   Do Until fName = ""
  108.     fFile = strDir & fName
  109.     ListBoxName.AddItem fFile
  110.     If FormName.TextWidth(fFile) > maxWdth Then
  111.       maxWdth = FormName.TextWidth(fFile)
  112.     End If
  113.     NumFound = NumFound + 1
  114.     fName = Dir
  115.   Loop
  116.  
  117. End Sub
  118. Public Sub lstBoxGetAllFiles(ByVal strDir As String, ByVal Extension As String, FormName As Form, ListBoxName As ListBox, Optional NumFound As Long, Optional ResetMaxWidth As Boolean = True)
  119.    
  120. Dim fPath$, fName$, fPathName$
  121. Dim hfind&, nameLen%, matchLen%
  122. Dim WFD As WIN32_FIND_DATA
  123. Dim found As Boolean
  124.  
  125.   If ResetMaxWidth = True Then maxWdth = 0
  126.  
  127.   fPath = strDir
  128.   If Right(fPath, 1) <> "\" Then
  129.     fPath = fPath & "\"
  130.   End If
  131.    
  132.   matchLen = Len(Extension)
  133.   Extension = LCase$(Extension)
  134.  
  135.   'The first API call is FindFirstFile
  136.   hfind = FindFirstFile(fPath & "*", WFD)
  137.   found = (hfind > 0)
  138.  
  139.   Do While found
  140.  
  141.     fName = TrimNull(WFD.cFileName)
  142.     nameLen = Len(fName)
  143.     fPathName = fPath & fName
  144.    
  145.     If fName = "." Or fName = ".." Then
  146.  
  147.     ElseIf WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY Then lstBoxGetAllFiles fPathName, Extension, FormName, ListBoxName, NumFound, False
  148.        
  149.     ElseIf matchLen > nameLen Then
  150.    
  151.     ElseIf LCase$(Right$(fName, matchLen)) = Extension Then
  152.       ListBoxName.AddItem fPathName
  153.       NumFound = NumFound + 1
  154.       If FormName.TextWidth(fPathName) > maxWdth Then
  155.         maxWdth = FormName.TextWidth(fPathName)
  156.       End If
  157.     End If
  158.    
  159.     'Subsequent API calls to FindNextFile
  160.     found = FindNextFile(hfind, WFD)
  161.    
  162.   Loop
  163.  
  164.   'Then close the findfile operation
  165.   FindClose hfind
  166.  
  167. End Sub
  168.  
  169. Private Function TrimNull(ByVal Item As String) As String
  170.    
  171. Dim pos As Integer
  172.    
  173.   pos = InStr(Item, Chr$(0))
  174.   If pos Then Item = Left$(Item, pos - 1)
  175.    
  176.   TrimNull = Item
  177.  
  178. End Function
  179.  
  180. Private Sub Class_Initialize()
  181.  
  182.   maxWdth = 0
  183.  
  184. End Sub
  185.  
  186. Public Sub SetHorizontalBar(FormName As Form, ListBoxName As ListBox)
  187.  
  188.   maxWdth = maxWdth + FormName.TextWidth("  ")
  189.   maxWdth = maxWdth / Screen.TwipsPerPixelX
  190.   'The API call to add the horizontal scrollbar
  191.   SendMessageByNum ListBoxName.hwnd, LB_SETHORIZONTALEXTENT, maxWdth, 0
  192.  
  193. End Sub