FileSearch dislikes Zip-files

  • Thread starter Thread starter Hub van de Laar
  • Start date Start date
H

Hub van de Laar

L.S.

I encountered some problems using the FileSearch object.
Using the Macro you'll find below, it doesn'list the zip-
files that reside in the specified directory. When
replacing the Filename "*.zip" by "*.*", it lists all
files except the zip-files.

I've already reviewed the contents of the collections
PropertyTests and FileTypes, but had no results.

Using the interactive FileSearch from the Excel-sheet via
the menu-option provides the same results.


Private Sub CheckAllZipFiles()
Dim FS As FileSearch, I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "D:\"
.FileType = msoFileTypeAllFiles
.Filename = "*.zip"
.SearchSubFolders = True
If .Execute > 0 Then
For I = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(I)
Next I
Else
MsgBox "No files found."
End If
End With
End Sub
 
That may be an operating system thing. I believe in Windows XP, you can
look at the interior of a zip file like it was a folder - so that might be
what filesearch is doing.

However, in Excel 2000 on Windows XP professional, It worked for me - found
the zip files. BUt on some, I was getting a double find - found it twice.

I guess the robust solution would be to have it pull a list of all files,
then run through the list and extract the zip files, or use the filesystem
object or the windows API.
 
Hi Tom

Win XP Pro with Excel 2000
Code is working correct for me with a small test

So it seems a Office 2002/2003 problem Tom under Win XP
 
Back
Top