S
Steve
Hello
I would like to look through a folder of files (mypath) that are all named
the same (myfile_20090123_1.xls) find the most recent file and extract the
yyyymmdd_X and use it to save my file as myotherfile_xxxxmmdd_X.xlsx.
I am using this elsewhere to find the most recent file...
Const FilePath = "Mypath"
Set fso = CreateObject _
("Scripting.FileSystemObject")
Set Folder = _
fso.GetFolder(FilePath)
MyDate = 1
Myfile = ""
For Each fl In Folder.Files
PeriodPos = InStrRev(fl.Name, ".")
EXT = Left(fl.Name, 7)
If UCase(EXT) = "My_File" Then
If fl.DateLastModified > MyDate Then
Myfile = fl.Path
MyDate = fl.DateLastModified
End If
End If
Next fl
What do I add to finish this off?
Thanks
I would like to look through a folder of files (mypath) that are all named
the same (myfile_20090123_1.xls) find the most recent file and extract the
yyyymmdd_X and use it to save my file as myotherfile_xxxxmmdd_X.xlsx.
I am using this elsewhere to find the most recent file...
Const FilePath = "Mypath"
Set fso = CreateObject _
("Scripting.FileSystemObject")
Set Folder = _
fso.GetFolder(FilePath)
MyDate = 1
Myfile = ""
For Each fl In Folder.Files
PeriodPos = InStrRev(fl.Name, ".")
EXT = Left(fl.Name, 7)
If UCase(EXT) = "My_File" Then
If fl.DateLastModified > MyDate Then
Myfile = fl.Path
MyDate = fl.DateLastModified
End If
End If
Next fl
What do I add to finish this off?
Thanks