Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Filesearch : .zip files not found ???

Hi all,

I've got a problem with this piece of code, which lists the contents
of a directory (thanks Ron de Bruin).

It works fine with all but zip files.

Files with .zip extension are not found, not counted ... why the hell
??? (Excel 2003, XP Pro)

thanks for your help !


Sub test2()
Dim i As Long
With Application.FileSearch
.NewSearch
.LookIn = "c:\Data"
.SearchSubFolders = False
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
Cells(i, 1).Value = .FoundFiles(i)
Cells(i, 2).Value = FileDateTime(.FoundFiles(i))
Cells(i, 3).Value = FileLen(.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 : .zip files not found ???

Hi

There are some problems with Application.FileSearch in Excel 2002/2003 with WinXP
You can use the Dir function (always working)

Sub TestFile()
Dim rnum As Long
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "C:\Data"
ChDrive MyPath
ChDir MyPath
FNames = Dir("*.*")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
rnum = 1

Do While FNames < ""
ActiveSheet.Cells(rnum, "A").Value = FNames
rnum = rnum + 1
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Benoît HUBERT" wrote in message ...
Hi all,

I've got a problem with this piece of code, which lists the contents
of a directory (thanks Ron de Bruin).

It works fine with all but zip files.

Files with .zip extension are not found, not counted ... why the hell
??? (Excel 2003, XP Pro)

thanks for your help !


Sub test2()
Dim i As Long
With Application.FileSearch
.NewSearch
.LookIn = "c:\Data"
.SearchSubFolders = False
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
Cells(i, 1).Value = .FoundFiles(i)
Cells(i, 2).Value = FileDateTime(.FoundFiles(i))
Cells(i, 3).Value = FileLen(.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
Creating a list of found files Tom Ogilvy Excel Programming 1 October 1st 03 08:21 PM
FileSearch dislikes Zip-files Hub van de Laar Excel Programming 4 September 1st 03 08:50 PM
FileSearch doesn't find zip files Hub van de Laar Excel Programming 3 September 1st 03 07:43 PM
FileSearch dislikes Zip-files Hub van de Laar Excel Programming 0 September 1st 03 06:53 PM
FileSearch dislikes Zip-files Hub van de Laar Excel Programming 0 September 1st 03 06:52 PM


All times are GMT +1. The time now is 06:35 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"