Find Files from a directory
path is the directory
ext is the extension such as txt for text files or imd for idea files
files() is the array that will hold all the files that are returned.
The following is an example of how you might acall it if you are looking for imd files
If (FindFiles(thisDir & "\", "imd", files) = True) Then
    x = UBound(files)
    ReDim listbox1$(x)
    For i = 0 To x     
       listbox1$(i) = files(i)
    Next
End If
Private Function FindFiles(path As String, ext As String, files())
   Dim ffile As String
   Dim firstbackspace As String
   Dim firstbackspacenum As Integer
   Dim importname As String
   ffile = Dir$(path & "*." & ext)
        
   If Len(ffile) = 0 Then Exit Function
     
   '-------- Dir ext = *.ext* fixing by checking length
   Do     
       
      firstbackspace = strReverse (ffile) 
      firstbackspacenum  = InStr(1,firstbackspace, ".")
      importname = Right(ffile, firstbackspacenum - 1)   
  
         If Len(importname) = Len(ext) Then 
  
            If Not IsNull(ffile) Then
             
               '-------- If one value found return function true and redim array 
               If (FindFiles = False) Then    
                  ReDim files(0)
                  FindFiles = True
               Else
                            
                  ReDim Preserve files(UBound(files) + 1)   
     
               End If
       
               files(UBound(files)) = ffile
      
            Else
               Exit Do
            End If
  
        End If
  
    ffile = Dir        
                 
    Loop Until Len(ffile) = 0
        
End Function
