ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Slow FileSearch Routine (https://www.excelbanter.com/excel-programming/298313-slow-filesearch-routine.html)

stratuser

Slow FileSearch Routine
 
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



All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com