> Let's say I've some files in a folder with the same suffix, for
example
.abc. Is there anyway I can let VB decide which one of them that is
the newest?
Run this code...
Dim Path As String
Dim Suffix As String
Dim FileName As String
Dim LatestFile As String
Dim LatestDate As Date
Path = "c:\temp\" ' Note the trailing backslash
Suffix = "abc" ' Note there is no leading dot
FileName = Dir$(Path & "*." & Suffix)
Do While Len(FileName)
If FileDateTime(Path & FileName) > LatestDate Then
LatestFile = Path & FileName
LatestDate = FileDateTime(Path & FileName)
End If
FileName = Dir$
Loop
and your file's name will be in the LatestFile variable and its
date/time stamp will be in the LatestDate variable.
Rick - MVP