Hello experts,
I just want to ask if you could help me in unzipping a zipped file or files with VBA. The zipped files contains excel files and they are located in a folder. The unzipped files should be in the same folder.
Thanks in advance...
Hello experts,
I just want to ask if you could help me in unzipping a zipped file or files with VBA. The zipped files contains excel files and they are located in a folder. The unzipped files should be in the same folder.
Thanks in advance...
PLS DO NOT PM; OPEN A THREAD INSTEAD!!!
1) Posting Code
[CODE]PasteYourCodeHere[/CODE]
(or paste your code, select it, click # button)
2) Uploading File(s)
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.
3) Testing the Codes
always back up your files before testing the codes.
4) Marking the Thread as Solved
from Thread Tools (on the top right corner, above the first message)
Hello entwined,
Here is a VBA version that works with Office 2007 and later. However, this macro can not unlock password protected Zip files.
The macro will unzip and copy the files in the given folder from each Zip archive (*.zip) in the same folder. In the macro the folder is "C:\Test". Change this what you using.
' Written: March 15, 2017 ' Author: Leith Ross Sub UnZipFiles() Dim File As Object Dim Files As Object Dim MainFldr As Object Dim MainPath As Variant Dim oShell As Object Dim ZipFile As Variant Dim ZipFldr As Object MainPath = "C:\Test" Set oShell = CreateObject("Shell.Application") Set MainFldr = oShell.Namespace(MainPath) Set Files = MainFldr.Items Files.Filter 32, "*.zip" For Each File In Files Set ZipFldr = oShell.Namespace(File) For Each ZipFile In ZipFldr.Items MainFldr.CopyHere ZipFile.Path Next ZipFile Next File End Sub
Sincerely,
Leith Ross
"1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG"