It's hard to go wrong with John Walkenbach...
http://www.j-walk.com/ss/excel/tips/tip97.htm
-or-
My own VBA code, using the FileSystemObject, allows one to specify
the number of most recent files to return.
I'll post the code upon request.
--
Jim Cone
Portland, Oregon USA
"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.