Gruppe
Datei
Problem
Im Verzeichnis C:\ wird nach allen Dateien mit den Extensions *.xls, *.gif und *.jpg gesucht.
StandardModule: Modul1
Sub DateienSuchen()
Dim arr As Variant
Dim iCounter As Integer, iFile As Integer
arr = Array("*.xls", "*.gif", "*.jpg")
For iCounter = LBound(arr) To UBound(arr)
With Application.FileSearch
.NewSearch
.LookIn = "c:"
.Filename = arr(iCounter)
.MatchTextExactly = True
.SearchSubFolders = False
.Execute
For iFile = 1 To .FoundFiles.Count
Cells(iFile, 1).Value = .FoundFiles(iFile)
Next iFile
End With
Next iCounter
End Sub