Thread: Found Files
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_19_] Stuart[_19_] is offline
external usenet poster
 
Posts: 7
Default Found Files

I have a folder with an ever expanding number of files named as follows

oldOrders001.xls
oldOrders002.xls
oldOrders003.xls
oldOrders004.xls
oldOrders005.xls
~
oldOrders095.xls

etc........

will the following piece of code always find the very last alphabetically
listed file, I only have win98 to test it on and am curious to know what
will happen on other platforms such as XP

With Application.FileSearch
.LookIn = "C:\shopmain\orders\done"
.SearchSubFolders = False
.FileName = "oldOrders*.xls"
.Execute
lastFile = .FoundFiles(.FoundFiles.Count)
End With