Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pick up file from specific location Mandeep Dhami Excel Discussion (Misc queries) 2 January 10th 08 10:32 AM
How to pick up file name in the cell Vijay Kotian Excel Discussion (Misc queries) 3 November 9th 06 03:44 PM
dialog box to pick path & file dlh[_7_] Excel Programming 1 October 12th 05 04:36 AM
Making pick list conditional on selection from previous pick list Stewart Excel Discussion (Misc queries) 1 June 27th 05 11:30 AM
Can I pick the size and position of an avi file? ste mac Excel Programming 2 May 13th 04 04:44 PM


All times are GMT +1. The time now is 04:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"