I have this in a Macro
Dim oSearch As FileSearch
Set oSearch = Application.FileSearch
With oSearch
.NewSearch
.LookIn = strDirName
.SearchSubFolders = False
' For example, to search for text files change this line to:
' .FileName "*.txt"
.Filename = "*.csv"
.Execute
CountAllFiles = .FoundFiles.Count
End With
End Function
how do I do the same in Excel 2010. I had the code above for Excel 2002.
It basically looks in the directory counts the number of files with *csv and gives me the number of those files.
Dim oSearch As FileSearch
Set oSearch = Application.FileSearch
With oSearch
.NewSearch
.LookIn = strDirName
.SearchSubFolders = False
' For example, to search for text files change this line to:
' .FileName "*.txt"
.Filename = "*.csv"
.Execute
CountAllFiles = .FoundFiles.Count
End With
End Function
how do I do the same in Excel 2010. I had the code above for Excel 2002.
It basically looks in the directory counts the number of files with *csv and gives me the number of those files.