M
muyBN
In the following code, I need to open the file which has been modified last
but don't quite know how to write it. Your assistance in this will be
appreciated.
strPath = "C:\Data\misc\0PackIt\"
strFirstFile = ActiveDocument.name
With Selection
With Application.FileSearch
.NewSearch
.LookIn = strPath
.SearchSubFolders = False
.FileName = "*.csv"
.Execute (msoSortByLastModified)
intFiles = .FoundFiles.count
If .Execute(msoSortOrderAscending) > 0 Then
strFile '= last modifed file
End If
End With
End With
Documents.Open (strPath & "\" & strFile), AddToRecentFiles:=True,
Format:=11
but don't quite know how to write it. Your assistance in this will be
appreciated.
strPath = "C:\Data\misc\0PackIt\"
strFirstFile = ActiveDocument.name
With Selection
With Application.FileSearch
.NewSearch
.LookIn = strPath
.SearchSubFolders = False
.FileName = "*.csv"
.Execute (msoSortByLastModified)
intFiles = .FoundFiles.count
If .Execute(msoSortOrderAscending) > 0 Then
strFile '= last modifed file
End If
End With
End With
Documents.Open (strPath & "\" & strFile), AddToRecentFiles:=True,
Format:=11