Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to pick the right file
Hi all,
I have a series of Excel files in a directory out in the network. The file names are suffixed by a date stamp as in: "_mm-dd-yyy.xls". I need to open the latest file. But the latest file can be older than the date in the system's clock. For example, it can be Monday today and the latest file is from previous week's Friday. I was thinking of using a array or file system object to read in all the files and truncate the date portion and compare them. But that seems me a very ineffective and inefficient way of doing thing. Can you share your thoughts or code snipppets? Thanks. Ben -- -- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to pick the right file
If it will always be withing a couple of days
Dim dt as Date dt = Date do while dir("C:\Myfolder\*_" & format(dt,"mm-dd-yyyy.xls") = "" dt = dt - 1 if dt < Date - 5 then msgbox "Problems" exit sub end if Loop -- Regards, Tom Ogilvy "Ben" wrote: Hi all, I have a series of Excel files in a directory out in the network. The file names are suffixed by a date stamp as in: "_mm-dd-yyy.xls". I need to open the latest file. But the latest file can be older than the date in the system's clock. For example, it can be Monday today and the latest file is from previous week's Friday. I was thinking of using a array or file system object to read in all the files and truncate the date portion and compare them. But that seems me a very ineffective and inefficient way of doing thing. Can you share your thoughts or code snipppets? Thanks. Ben -- -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pick up file from specific location | Excel Discussion (Misc queries) | |||
How to pick up file name in the cell | Excel Discussion (Misc queries) | |||
dialog box to pick path & file | Excel Programming | |||
Making pick list conditional on selection from previous pick list | Excel Discussion (Misc queries) | |||
Can I pick the size and position of an avi file? | Excel Programming |