How to make a filesearch sorted on last modified files

B

Björn

I try the following, but when sorting on LastModified it
always sorts ascending on filename. This is what i try:

With Application.FileSearch
.NewSearch
.LookIn = testpath
.SearchSubFolders = True
.FileName = *.doc"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.LastModified = msoLastModifiedAnyTime
End With

With Application.FileSearch

If .Execute(SortBy:=msoSortByLastModified, _
SortOrder:=msoSortOrderDescending) <> 0 Then
..
..
..
Exactly the same reults when using Ascending
/Björn
 
W

Word Heretic

G'day "Björn" <[email protected]>,

preload all the valid results into an array and wodbasic.sortarray the
sucker yourself

Björn said:
I try the following, but when sorting on LastModified it
always sorts ascending on filename. This is what i try:

With Application.FileSearch
.NewSearch
.LookIn = testpath
.SearchSubFolders = True
.FileName = *.doc"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.LastModified = msoLastModifiedAnyTime
End With

With Application.FileSearch

If .Execute(SortBy:=msoSortByLastModified, _
SortOrder:=msoSortOrderDescending) <> 0 Then
.
.
.
Exactly the same reults when using Ascending
/Björn

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email [email protected]
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
Top