Looping through files

G

GLT

Hi,

I am trying to loop through a directory of (.txt) files.

What I would like to do is append the last 4 days (from today's date) worth
of files into one file, and save that file for later processing.

Does anyone know or have the logic that I need to process these files?

Cheers,
GT
 
A

Allen Browne

Use Dir to loop through the files in a folder.

Here's a very simple example of appending them to an array:
http://allenbrowne.com/func-02.html

Use FileDateTime() to test if they are in the last 4 days; presumably you
don't add the old ones to your array.

I think you want to write the file names to a text file? If so, see help (in
the VBA window) on Open. You will Open For Output, and Print # to write each
line.
 
Top