Unzip a zip file with 7-Zip (VBA)
Ron de Bruin (last update 17-May-2009)
Go back to the Excel tips page
The basic examples on this page use VBA code to unzip a zip file with:

7-Zip
http://www.7-zip.org/

For example code to Zip files with 7-Zip visit :
Zip Activeworkbook, Folder, File or Files with 7-Zip (VBA)

For examples for WinZip or the default Windows Zip program see the Zip (compress) section here
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/code7zippageunzip.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: I use the .zip extension in my examples but you can also use the extension .7z

The first example above you can test without changing the code.
Only if you want to test the macro: B_UnZip_Zip_File_Fixed
You must change the string NameUnZipFolder to the folder where you want to unzip the files
NameUnZipFolder = "C:\Users\Ron\TestFolder\"

Important: Read the comments above and in the code good for tips.

7-Zip have also a good help file (7-zip.chm) so if you want to know more read this first
You can find it it this folder : C:\Program Files\7-Zip
There is also a forum on the 7-Zip site that you can visit.