Microsoft Excel

Ron de Bruin
Excel Automation

Microsoft MVP Program

Unzip a zip file with 7-Zip (VBA)

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

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

For example code to zip with 7-Zip visit :
Zip Activeworkbook, Folder, File or Files with 7-Zip (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: 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 if you need help.