Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filesearch for Zip files

Status
Not open for further replies.

whoffman

Programmer
Jun 12, 2002
28
US
I recently upgraded OS and Office to XP and I am having great difficulty getting old Excel macros to work. One especially troubling one is the filesearch().
I have a directory with at least one *.zip file but I cannot get it to enumerate with the following code:

Dim fnmes(10)
Set fs = Application.FileSearch
With fs
.NewSearch
.FileType = msoFileTypeAllFiles
.LookIn = "C:\Test\"
.SearchSubFolders = False
.Filename = "*.*"
.Execute
End With
fc = fs.FoundFiles.Count
For x = 1 To fc
MsgBox fs.FoundFiles(x)
Next


It will return all files in the directory EXCEPT the zip files. It's like they don't exist (but they do)!
It used to work fine. Any suggestions? Thanks!
 
You said it lists all EXCEPT 'ZIP's...have you checked to make sure they are not hidden or marked as system files?

Did you try changing the following red line?

Code:
With fs
    .NewSearch
    .FileType = msoFileTypeAllFiles
    .LookIn = "C:\Test\"
    .SearchSubFolders = False
    [red].Filename = "*.*"[/red]
    .Execute
End With

--MiggyD
 
I don't see where you've changed the red line from what I had, but I have tried "*.zip", "*.z*", "A*.*", (since the filename is ADR.ZIP) and nothing works! It is not a hidden or system file according to its attributes. This used to work fine in Windows 2000, so it must be one of the 'enhancements' offered by XP. Grrrrrr! Thanks for your help anyway. :)
 
Just a though: Does'nt XP presents a Zip file as a folder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
XP sort of presents the file as a folder. It isn't automatic. You have to right click on the "file" and select "Explore". I guess this is why most serious programmers/geeks hate microsoft.
 
I'm getting the same problem, even with .SearchSubFolders=True. If anybody finds a fix/workaround, pls let me know.
 
whoffman, your code works for me: WinXP/pro, Office2003.
BUT I have WinRAR installed and thus no attempt from WinXP to treats the zip file as "compressed files folder".

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks! It sounds more and more as though this is a WinZIP issue and not an XP issue. I, of course, being a lowly departmental programmer and not the elite IT professional where I work, have no say in what software packages are deployed to each workstation. I must adapt to any and all situations and maintain the existing code.
Thanks everyone for your help and input!!!
 
Have you tried the Dir function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Did anyone find an answer to this? I'm having the same problem - but I don't even have WinZip installed!

Thanks,
Jeff
 
And this ?
x = Dir("C:\Temp\*.zip")
While x <> ""
MsgBox x
x = Dir
Wend

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top