View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Get the most recent file from a directory

Is the date encoded in the file name in anyway?

--
Rick (MVP - Excel)


"Peter B. Steiger" wrote in message
. ..
I'm writing a VBA macro that compares data between the currently open
worksheet and the one produced the previous week. Right now the user has
to manually open the previous worksheet, but I thought it would be nifty
if I automatically open it.

So my question is, given a target folder cLocation and a pattern
"foo*.xls", how can I get the name of the most recent (prior to today)
matching file in that location?

--
Peter B. Steiger
Cheyenne, WY
If you must reply by email, you can reach me by placing zeroes
where you see stars: wypbs.**1 at gmail.com.