FileSearch.Execute sorting by LastModified does not work
Posted on 2000-05-02
This seems to be a bug in Office. Perhaps there is something I'm overlooking?
While performing a FileSearch, the sort feature works with all but the msoSortByLastModified constant. It reverts to sorting by FileName.
I attached my code below. Is this real or am I missing something?
Dim ffile As Variant
.LookIn = "C:\" 'Directory to search
.FileName = "*.*" 'File types to look for
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute(msoSortByLastModified, 2) > 0 Then 'If matching files are found
On Error Resume Next
For Each ffile In .FoundFiles
Set f = fs.GetFile(ffile)
Debug.Print (ffile & vbTab & vbTab & FileDateTime(ffile))