View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
General General is offline
external usenet poster
 
Posts: 13
Default Filesearch returning files not in alphabetical order?

Hi,

I have a macro where I do the following:
1) Search for all files in a directory:
Set fs = Application.FileSearch
With fs
.LookIn = dirtosearch
.SearchSubFolders = True
.Filename = "*.*"
.Execute
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
Max = .FoundFiles.Count
for i = 1 to max
list(i) = .foundfiles(i)
next i
******at this point I pause the code
And look at the list array using the watch window, expecting that the
entries are in alphabetical order by the filename.

What I find is it is "almost" in alphabetical order. I found, for
example, the filename for 1213="Mat...", 1214="Man...", 1215="Mat..."!

Help! For my code I need the files to be alphabetized. What am I doing
wrong? Suggestions?

Thanks everyone,

Phil