Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default FileSearch doesn't find zip files

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default FileSearch doesn't find zip files

Try the Dir function

Sub test()
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
MyPath = "C:\"
ChDir MyPath
TheFile = Dir("*.zip")
Do While TheFile < ""
Debug.Print TheFile
TheFile = Dir
Loop
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default FileSearch doesn't find zip files

Ron,

Sorry, I posted too many times the same item, but the
message was confusing: "Your message should be posted
within a few minutes". So I was trying faster and faster.
Can someone replace the "should" by "will" ?

Ofcourse, the Dir function can be used. But the Dir
function is complicated to be used for scanning
subdirectories too. Recursive prograaming is not possible
since Dir looses track wehen reentering a higher level. I
once circumvented this problem with an quite extensive
macro. FileSearch should work simpler?

Kind regards,
Hub

-----Original Message-----
Try the Dir function

Sub test()
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
MyPath = "C:\"
ChDir MyPath
TheFile = Dir("*.zip")
Do While TheFile < ""
Debug.Print TheFile
TheFile = Dir
Loop
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"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



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.FileSearch Cleberton(Brazilian) Excel Discussion (Misc queries) 2 October 26th 09 01:21 PM
FileSearch in a combo box michaelberrier Excel Discussion (Misc queries) 0 June 16th 06 12:21 AM
Import multiple files macro can't find files Steven Rosenberg Excel Programming 1 August 7th 03 01:47 AM
FileSearch Code Pedro[_4_] Excel Programming 1 August 6th 03 02:27 PM
FileSearch Problem Bin[_2_] Excel Programming 6 August 2nd 03 02:04 PM


All times are GMT +1. The time now is 01:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"