AccessHelp123
Programmer
Hi, I am trying to unzip all zip files in a folder using VBA. For some reason Application.filesearch does not find zip files.. I am using the code below...
With Application.FileSearch
.NewSearch
.fileType = msofiletypeAllFiles
.filename = "*.zip"
.LookIn = filePath
.matchtextExactly = True
If .Execute() > 0 Then
For EveryFile = 1 To .foundfiles.Count
fPathTemp = .foundfiles(EveryFile)
UnZip_ZipFile_1 filename, filePath
Next
Else
MsgBox "There were no files found."
End If
'Application.ScreenUpdating = True
End With
It does not find zip files..
I also tried using the Dir function but after the first call it does not find any more zip files...
filename = Dir(filePath & "*.zip")
While filename <> ""
UnZip_ZipFile_1 filePath & filename, filePath
filename = Dir()
' The filename is empty after this call for some reason
'even though i have more than 5 files in the folder
Wend
Exit Sub
Can someone please help?
With Application.FileSearch
.NewSearch
.fileType = msofiletypeAllFiles
.filename = "*.zip"
.LookIn = filePath
.matchtextExactly = True
If .Execute() > 0 Then
For EveryFile = 1 To .foundfiles.Count
fPathTemp = .foundfiles(EveryFile)
UnZip_ZipFile_1 filename, filePath
Next
Else
MsgBox "There were no files found."
End If
'Application.ScreenUpdating = True
End With
It does not find zip files..
I also tried using the Dir function but after the first call it does not find any more zip files...
filename = Dir(filePath & "*.zip")
While filename <> ""
UnZip_ZipFile_1 filePath & filename, filePath
filename = Dir()
' The filename is empty after this call for some reason
'even though i have more than 5 files in the folder
Wend
Exit Sub
Can someone please help?