Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Application.FileSearch | Excel Discussion (Misc queries) | |||
FileSearch in a combo box | Excel Discussion (Misc queries) | |||
Import multiple files macro can't find files | Excel Programming | |||
FileSearch Code | Excel Programming | |||
FileSearch Problem | Excel Programming |