Searching for multiple file names

raindrop3

Registered User.
Local time
Today, 01:24
Joined
Sep 6, 2001
Messages
98
Hello,

I have this function that search for .jpg files:

Function Filecount(strLookin As String)
Dim file As Variant
With Application.FileSearch
.FileName = ".jpg"
.LookIn = strLookin
.SearchSubFolders = True
.Execute
For Each file In .FoundFiles
Next file
FileAmount = .FoundFiles.Count

End With
End Function

I want that this function also find files with the extension .tif and .bmp. I tried in in several manners, but the only solution is to write this function for every extension again. Can one function find files with the extension .jpg, .tif and .bmp?

Thanks,

Albert
 
Go to this web site
http://www.mvps.org/vbnet/

Then look for this article:
Minimal Code for a Single or Multiple File Extension Recursive Search for Files (single drive)

You should be able to modify this to do what you want.
 

Users who are viewing this thread

Back
Top Bottom