I am currently using this code which does work, but it's SLOW...
I was wondering if there was an alternative method or a way I could speed up this code.
It's searching a directory and it's sub-directories for files that are either xls or doc then counting them all up.
Thanks!
I was wondering if there was an alternative method or a way I could speed up this code.
It's searching a directory and it's sub-directories for files that are either xls or doc then counting them all up.
Code:
With Application.FileSearch
.LookIn = strSourceFolder
.FileType = msoFileTypeAllFiles
.searchSubFolders = True
.Execute
For x = 1 To .FoundFiles.Count
i = x
On Error GoTo Skip
Set objFile = objFSO.GetFile(.FoundFiles(x))
If Right(objFile.Name, 3) = "xls" Or Right(objFile.Name, 3) = "doc" Then
PopulateDirectoryList = PopulateDirectoryList + 1
End If
Skip:
Next x
End With
Thanks!