Problem with FileSearch

J

John Crawford

OS: MS Me
PP version: 2000

I have been looking at the Execute sort function. I have found an
odd situation, and wonder if it ia a known problem, or what????
In my testing I can sort by Name, and type and size, but NOT by last
modified. However if I sort by size and then by last modified then it
sorts correctly???
The following code shows the two procedures that I used to test this
'=======================================================================

Sub TestSort1()
Dim fs
Dim i As Integer
Set fs = Application.FileSearch
With fs
.LookIn = "e:\MS Office Data\PowerPoint Data\Foreground\"
.filename = "*.*"
If .Execute(SortBy:=msoSortByLastModified, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "Sort 1 There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With

End Sub

Sub TestSort2()
Dim fs
Dim i As Integer
Set fs = Application.FileSearch
'msoSortbyFileName
'msoSortbyFileType
'msoSortbyLastModified
'msoSortbySize
With fs
.LookIn = "e:\MS Office Data\PowerPoint Data\Foreground\"
.filename = "*.*"
If .Execute(SortBy:=msoSortBySize, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "Sort 2 There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With

End Sub

'=====================================================================
If I run TestSort1(by modified) I get an alphabetic sort,
regfardless of how many times I run it. If I run TestSort2(by size), and
then TestSort1, the sort by modified works fine!!!
It seems to only work with that combination. Running a sort by Name
or Type has no affect on the by modified.
If I am in development mode (within PP) if I run the the size sort,
regardless of how many times I start the show PP seems to be able to
remember how to sort by modified.
If I try to run it from a show this does not occur from one running
of the show to the next (makes sense).
This is not the first type of condition that I have come accross. I
also realize that I am working with PP 2000, and there may be problems
with it that I will just have to live with.
Any enlightenment would be appreciated.
Thanks in advance
John Crawford
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top