'---------------------------------------------------------------------------------------
' Procedure : UnZip_ZipFile
' Author : Darth Vodka
' Date : 27/11/07
' Purpose : unzips a file to a certain location
' : if the targetfile is specified, it renames the last file it has created (so it won't rename all
' : if there are many in the extract)
'---------------------------------------------------------------------------------------
'
Sub UnZip_ZipFile(strZippedFileName As String, strTargetFolder As String, Optional strTargetFile As String)
Const PATHWINZIP As String = "C:\progra~1\winzip\"
Dim ShellStr As String
On Error GoTo ErrorHandler
ClearDirectory strTargetFolder
WaitFor 2
'This will check if this is the path where WinZip is installed.
If Dir(PATHWINZIP & "winzip32.exe") = "" Then
MsgBox "Please find your copy of winzip32.exe and try again"
Exit Sub
End If
'Unzip the zip file in the folder FolderName
ShellStr = PATHWINZIP & "Winzip32 -min -e" _
& " " & Chr(34) & strZippedFileName & Chr(34) _
& " " & Chr(34) & strTargetFolder & Chr(34)
Shell ShellStr, vbHide
If IsMissing(strTargetFile) = False Then
WaitFor 2
FileCopy strTargetFolder & Dir(strTargetFolder), strTargetFolder & strTargetFile
End If
Exit Sub
ErrorHandler:
With Err
Select Case .Number
Case Else
ErrorLog .Number, .Description, "modUtilities", "DeleteImportFiles"
End Select
End With
End Sub