I have the following VBA code to extract all the files within a given directory.
Sub extractAllFiles()
Dim MyObj As Object, MySource As Object, file As Variant
Dim shellStr As String
file = Dir("C:\Downloads\")
While (file <> "")
If InStr(file, ".gz") > 0 Then
shellStr = "winzip32 -e C:\Downloads\" & file & " C:\Downloads\"
Call Shell(shellStr, vbHide)
End If
file = Dir
Wend
End Sub
When I execute this sub routine I get a Run-Time error 53, "File Not Found" error. When I copy the shellStr... Example: winzip32 -e C:\Downloads\file1.gz C:\Downloads\
and execute it from command prompt, it works perfectly! I get the text file within file1.gz extracted to the downloads directory. However running it from VBA doesn't seem to work.
Can anyone shed some light?