Microsoft Excel

Ron de Bruin
Excel Automation

Microsoft MVP Program

Zip Activeworkbook, Folder, File or Files with WinZip (VBA)

The basic examples on this page use VBA code to zip the ActiveWorkbook, Folder, File or Files with:


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.

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 :
Unzip a zip File with WinZip(VBA)



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.

Four examples above you can test without changing the code. Only if you want to test the macro: B and D you must change something in the code. Important: Read the comments above and in the code good and after you test the code examples you can try the commented examples in the first macro : Zip_Folder_And_SubFolders_Browse