Unzip a zip File with WinZip(VBA)
Ron de Bruin (last update 24-May-2009)
Go back to the Excel tips page
The basic examples on this page use VBA code to Unzip a zip File with:

WinZip
http://www.winzip.com/

Important: WinZip is not free and the code is only working if you have a registered(no trial) copy of WinZip.
See the Zip (compress) section on my site if you want to use a free program like 7-zip.
I really like 7-zip so check out my 7-zip pages if you are looking for a good free alternative.

Read this :
The code example on this page are using Shell to run winzip32.exe from the command line.
The undocumented parameters below were made available a long time ago, but have not been
supported since the release of WinZip 9.0 SR-1 in December of 2004. But they are still working OK.
Read the undocumented parameters information on this page

WinZip 12.1 does have an add-on (WinZip Command Line Support Add-on 3.1) available which would
allow you to perform many sophisticated actions from a command prompt, batch file, or other script.
I will also create a example page with code that use this add-in when I have time.


Code to Zip with WinZip

For example code to : Zip Activeworkbook, Folder, File or Files with WinZip visit
http://www.rondebruin.nl/zip.htm 


Code for other Zip programs

For examples for 7-zip or the Default Windows Zip program see the Zip (compress) section on my site
http://www.rondebruin.nl/tips.htm



Examples

I have add all the code in a txt file on my site so it is easy to copy it in a module of your workbook.

Click on the link below
http://www.rondebruin.nl/files/codewinzipunzippage.txt

1. Ctrl a to select all the code
2. Ctrl c to copy
3. Press the Back button in your browser to go back to this page


Open Excel or make Excel the active program
1. Alt-F11 to open the VBA Editor
2. Insert>Module from the Menu bar
3. Ctrl v to Paste the Code
4. Alt-q to go back to Excel

When you use the shortcut Alt F8 now you can see and run the macros.



Note: In WinZip 12 on my test machine it will automatic open the normal folder with the unzipped files in
Windows Explorer, I not see that in versions 9 for example. Let me know if you see that also in version 10/11.

Example A above you can test without changing the code.
Only if you want to test example B you must change this code line
FileNameZip = "C:\Users\Ron\Test.zip" To the path/name of your zip file.

Important: Read the comments above and in the code good