find latest date modified file

J

Junior728

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?
 
N

NickHK

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
 

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

Top