find latest date modified file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ,

I am trying to write a macro that goes into the same folder directory and
searches for the latest modified file and open that workbook... the Dir is
"H:\My WorkStation\PRCD" , and the filename is named after PRCD and the date
when the file is created....so each time a new worksheet will be created by
date created.e..g. in the folder, these are the worksheet found:

PRCD052207.xls 'this is the most newest file looking at the "date Modified:
PRCD041807.xls
and so on....

How can i write the macro to run this?
 
Use Dir( ) in a loop
You mean the filename represent dates ?
Parse the filename to extract a date part and compare to the newest
found so far.

Or you mean check the file date that the OS exposes ?
Similar to above but use FileDateTime( ).

NickHK
 
Back
Top