Want to Unzip files automatically

H

Hari

Hi,

I want to open some Zipped files through VBA (Excel) and then unzip them to
my target folder.
I got ready made stuff for me from Ron de Bruin's site
http://www.rondebruin.nl/unzip.htm#zip

But the problem is ....I have Windows XP and probably zipping is integrated
in to XP so for me
the statement "Pathwinzip = .." doesnt make sense. Also, within ShellStr it
did not make sense to me
to include pathname so, I modified the above code to the following...

Sub UnZip_ZipFile_1change()
Dim PathWinZip As String, FileNameZip As String
Dim ShellStr As String, FolderName As String

FileNameZip = "C:\Documents and Settings\abc\Desktop\DEV1_1022.zip"
FolderName = "C:\Documents and Settings\abc\Desktop\Unzipped data"

ShellStr = FileNameZip & Chr(34) _
& " " & Chr(34) & FolderName & Chr(34)
ShellAndWait ShellStr, vbHide
MsgBox "Look in " & FolderName & " for extracted files"
End Sub

But by doing that, VBA displays an error "Run-time error '53': File not
found" when it is processing "hProg = shell(PathName, WindowState)" within
Public Sub ShellAndWait .

(I didnt want to make the mail very big, so didnt paste Ron's actual code
here. If that is not a correct practice please tell me so and in future I
would paste the 'source-code' as well)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top