I need to figure out how to edit this code to work for multiple zip files, not just a single hard coded file. I could call the unzip method multiple times on a list but I can't figure out how to retrieve the file names from a listbox in order to call unzip on the file. Any help out there ? ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Code:
Sub UnzipSingle()
Dim FSO As Object
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
fname = CurrentProject.Path & "\Files.zip"
If fname = False Then
'do nothing
Else
'Set default path to current database folder
DefPath = CurrentProject.Path
If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If
strDate = Format(Now, " dd-mm-yy h-mm-ss")
FileNameFolder = DefPath & "MyUnzipFolder " & strDate & "\"
'Create normal folder
MkDir FileNameFolder
Set oApp = CreateObject("Shell.Application")
'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname).Items
MsgBox "You find the files here: " & FileNameFolder
On Error Resume Next
Set FSO = CreateObject("scripting.filesystemobject")
FSO.DeleteFolder Environ("Temp") & "\Temporary Directory*", True
Set oApp = Nothing
Set FSO = Nothing
End If
End Sub