[dba-Tech] Determine the last file in a folder

Jon Tydda Jon.Tydda at alcontrol.co.uk
Fri Aug 10 09:45:06 CDT 2007


Arthur,

I've got some code here that I use to check the latest version of an add in.
If you'd like me to post the code I can, but I think it's a bit long for the
list, else I can just mail you a copy of the code. It's all full of error
handling, correctly set up dims and everything. And yes, that means someone
else wrote it :-)


Jon

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com]On Behalf Of Gustav Brock
Sent: Friday, August 10, 2007 3:38 PM
To: dba-tech at databaseadvisors.com
Subject: Re: [dba-Tech] Determine the last file in a folder


Hi Arthur

You could read in the filenames one by one with Dir.
Convert the filename to YYMMDD to sort correctly, and detect if it is larger
than the previously stored; if so, replace the stored filename with the
current.
When you have read all the filenames, you are done.

/gustav

>>> fuller.artful at gmail.com 10-08-2007 16:20 >>>
Hi all,

I'm working on some Excel VBA in which I need to determine the last file in
a folder. The folder contains one file for each business day in a month, all
named like this: 062907 (June 29). I can't necessarily trust the date stamp
on the file so I have to go by the filenames and determine the "largest"
filename, as it were.

Any suggestions?

TIA,
Arthur


_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com


The information in this e-mail is confidential and may also be legally
privileged. The contents are intended for recipient only and are subject
to the legal notice available on request from : webmaster at alcontrol.co.uk
ALcontrol Laboratories is a trading division of ALcontrol UK Limited.
Registered Office: Templeborough House, Mill Close, Rotherham, S60 1BZ.
Registered in England and Wales No 4057291



More information about the dba-Tech mailing list