Microsoft Excel
Back to jkp-ads.com

Ron de Bruin
Excel Automation

Microsoft MVP Program

Unzip a zip File with WinZip(VBA)

Important message to visitors of this page

Ron de Bruin decided to remove all Windows Excel content from his website for personal reasons. If you want to know why, head over to rondebruin.nl.

Luckily, Ron was kind enough to allow me to publish all of his Excel content here.

Most of these pages are slightly outdated and may contain links that don 't work. Please inform me if you find such an error and I'll try to fix it.

Kind regards

Jan Karel Pieterse


The basic examples on this page use VBA code to unzip with:

WinZip
http://www.winzip.com/win/en/index.htm

Read this: 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.

Important:
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 information about the undocumented parameters in this text file.

For WinZip 12.1 and up there is a WinZip Command Line Add-in available which would allow you to perform many sophisticated actions from a command prompt, batch file, or other script. Check this out if the code on this page does not do what you want.

Note: If you use version 12 you see that you have a option to use the extension .zip or .zipx (best compression). So it is possible that you must change the extension in the code to .zipx.

For example code to unzip a zip file with WinZip visit :
Zip Activeworkbook, Folder, File or Files with WinZip (VBA)

 

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 here to open the txt file

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. Don't know what it do when you use anoher version if WinZip because I not use Winzip anymore.

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