PDA

View Full Version : How to unzip files?



Cinema
10-19-2016, 01:55 AM
Hi,

I want to unzip zip files that are in the same Folder but in different subfolders. The path of the Folder is in Cell(1,1) and the names of the subfolders are listed in Range("B1:B" & LastRow). Next to the Names of the subfolders are the file names of the zip files. For example B1 has the entry \SubfolderTest\ and C1 has the entry test.zip

Now my aim is to unzip all zip files by Looping through the subfolders and then extract them all in the Mainfolder where the subfolders are.

Here is my code so far:



Sub TestRun()
Dim MY_DESTINATION As String
Dim MY_LOCATION As String
MY_DESTINATION = Range("A1").Value
For MY_ROWS = 1 To Range("B" & Rows.Count).End(xlUp).Row
MY_LOCATION = MY_DESTINATION & Range("B" & MY_ROWS).Value
MY_FILE = MY_DESTINATION & Range("B" & MY_ROWS).Value & Range("C" & MY_ROWS).Value
Call UnZip(MY_LOCATION, MY_FILE)
Next MY_ROWS
End Sub

Sub UnZip(ByVal MY_LOCATION As String, ByVal MY_FILE As String)
Dim oApp As Object



Set oApp = CreateObject("Shell.Application")



End Sub

snb
10-19-2016, 02:19 AM
Which program do you use to zip/unzip ?

Cinema
10-19-2016, 03:34 AM
I use the 7-zip Program