Hello everybody.
i did write some code in VBA reading all files with fitting a wildcard format from a given directory and all subdirectorys and place the found files and path in an excel sheet.
I used herefore the Application.FIleSearch object.
The problem is that this sometimes not working with Windows 7 or is not always recognizing "zip" files.
I Googled on internet and learned that it will be better to use FileSystemObject and Dir to do the job, because FileSearch is not allways supported by the system.
I did try to translate the code, but couldn't work it out.
How to translate the next code in the other FSO and Dir format?
Set bz = Application.FileSearch
With bz
.LookIn = FilePad
.SearchSubFolders = True
.Filename = wildC
If .Execute(SortBy:=msoSortByNone, SortOrder:=msoSortOrderAscending) > 0 Then
Sheets(Sheetnames(1)).Range("p5").Value = .FoundFiles.Count 'Plaats hoeveelheid files in P5
For i = 1 To .FoundFiles.Count
Sheets(Sheetnames(1)).Select
Range("A" & i + offset).Value = .FoundFiles(i) 'ZET FILENAME IN KOLOM A
plek = Testlocatie(i + offset, plek) 'TEST OF THE FILE NAAM IN BEIDE SHEETS OVEREENKOMEN OP DEZELFDE LOCATIE
plek = plek + 1
Next
End If
Set bz = Nothing
wereby WildC is the wildcard to search for and Filepad is the starting directory to look from including all subdirectorys?
Any help would be preciated.
Bookmarks