Fill list box with file names, sorted by creation date

TimTDP

Registered User.
Local time
Today, 17:25
Joined
Oct 24, 2008
Messages
213
I use the following to fill a list box with the names of files in a folder
Code:
Private Sub GetFileList()

Dim LoadFiles As String
Dim strFill As String
Dim FileFolder As String

FileFolder =  "C:\Temp\20132014\Orders"

LoadFiles = Dir$(FileFolder & "\*.pdf")
Do While LoadFiles > ""
   strFill = strFill & LoadFiles & ";"
   LoadFiles = Dir$
Loop

Me.lstWebOrders.RowSource = strFill

End Sub

How can I sort the list box so the files are shown by the date created, in descending order?

Thanks in advance
 
Tim, I think there is a method called FileDateTime, but I have not used it before.. I will see if I can find any links/tutorials..
Code:
? FileDateTime("N:\DONOT CHANGE\NOUSE\HEG.accdb")
09/05/2013 17:28:56
 
Last edited:

Users who are viewing this thread

Back
Top Bottom