VBA/Excel/Access/Word/Application/Application.FileSearch
Find files
<source lang="vb">
Sub findFile()
With Application.FileSearch .NewSearch .LookIn = "c:\BegVBA" .FileName = "store.mdb" .SearchSubFolders = True If .Execute() > 0 Then msgBox "The file " & .FoundFiles(1) & " was found" Else msgBox "The file is not found" End If End With
End Sub
</source>
Find file with wild character
<source lang="vb">
Sub findFile()
Dim i As Integer With Application.FileSearch .NewSearch .LookIn = "c:\" .FileName = "*.mdb" .SearchSubFolders = True If .Execute() > 0 Then For i = 1 To .FoundFiles.count Debug.Print .FoundFiles(i) Next i End If End With
End Sub
</source>