View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default FileSearch doesn't find zip files

Try changing

.Filename = "*.zip"

to


.Filename = ".zip"

Either one works for me (xl97, win 98 SE) but
my understanding is that the latter is the more robust of the two.

--
Regards,
Tom Ogilvy

Hub van de Laar wrote in message
...
L.S.

I created the Macro you find here below. Zip-files that
reside in the directory are not listed. Replacing
Filename "*.zip" by "*.*" lists every file except the zip-
files.
I've reviewed contents in the collections PropertyTests
and Filetypes too, but without results.

Execution of the FileSearch interactively at the Excel-
sheet using the menu-option, has the same result. It also
doesn't list zip-files.

Kind regards,
Hub van de Laar

Private Sub ListZipFiles()
Dim FS As FileSearch, I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "D:\"
.FileType = msoFileTypeAllFiles
.Filename = "*.zip"
.SearchSubFolders = False
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(I)
Next I
Else
MsgBox "There were no files found."
End If
End With
End Sub