View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Enohp Aikon Enohp Aikon is offline
external usenet poster
 
Posts: 8
Default Return most recent file in subdirectory with out using FileSearch

The file search object does not work properly on all platforms. This is a
known issue but the workarounds provided in article 305342 do not resolve the
problem when using a local hard drive mapped to K:. I need
recommendations for returning the most recent file in a subdirectory with out
using the FileSearch object.

The following code works as expected except when using Office XP with
Windows 2000.
------------------------------------------------------------------------------
With Application.FileSearch
..Newsearch
..Lookin = K:\
..SearchSubFolders = false

NumFound = .Execute(SortBy: msoSortByLastModified, _
SortOrder: = msoSortOrderDescending _
AlwaysAccurate = True)

If NumFound 0 then NewestFile = FilesFound(1)
-------------------------------------------------------------------------------

I need code that works on any combination of Office 2000 and above with
Window 2000 and above. The code above is generic and I will actually be
using a function.

Thanks