#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default File list

Clint,
you might want to check out the file object f1 in your code. I believe you
should be able to use the file object to retrieve the file properties for
the date created or modified. See below link for a description of the
object.
Store the date and names in an array and then create a sort function that
sorts the array by the dates.
Hope this helps,
Felix

http://msdn.microsoft.com/library/de.../jsobjfile.asp

"Clinton Goff" wrote in message
news:kKWsb.196557$Fm2.181263@attbi_s04...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I hide unused file types from file types list in save dial Estra Q Excel Discussion (Misc queries) 1 December 17th 09 12:36 PM
Clear the file open file name dropdown list Daniel.C[_2_] Excel Discussion (Misc queries) 8 October 23rd 08 09:47 AM
List FullFilePath and File name FrodeOlsen Excel Worksheet Functions 0 January 31st 07 09:06 PM
The 'Recently used file list' does not show up under the 'File' menu. David F Excel Worksheet Functions 4 June 6th 05 07:43 AM
File List Creation robert Excel Programming 2 November 4th 03 07:56 PM


All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"