File list


C

Clinton Goff

I have written an Excel macro that does some data manipulation. I am
however, having one problem. I am trying to get a list of files from a
certain directory and store them in a "string" array. I need the files to
be listed in this array in order of time and date starting with the oldest
and ending with the newest. Here is the code that I have:

Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
i = 1

For Each f1 In fc
fname(i) = f1.Name
i = i + 1
Next

With this code, it gives the list in somewhat chronological order, but there
are a few places where it is out of order. Does anybody know a solution?
Thanks,
Clint
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top