Microsoft Excel
Back to jkp-ads.com

Ron de Bruin
Excel Automation

Microsoft MVP Program

Unzip a zip file with 7-Zip (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 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.