Slow File Search

  • Thread starter Thread starter stratuser
  • Start date Start date
S

stratuser

The code below slows down for several seconds because of
the "LastModified" line, and I can't figure out why, since
there are only a few dozen files involved here. If I take
out that one line, the code executes instantly. Any ideas?


Directory = Range("Inputsubdirectory").Value

On Error Resume Next
With Application.FileSearch
.NewSearch
.LookIn = Directory
.Filename = "*.xls*"
.LastModified = msoLastModifiedLastMonth
.SearchSubFolders = False
.Execute

End With
 
You have given Excel more work to do.
Are the files on a server ? Things usually happen slower if so.
I wonder if checking the date of each file before opening would b
faster. (VB FileDateTime function)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top