Unzipping gz files
I have an application which processes data that is received in zipped files with a '.gz' suffix from our mainframe. Normally these files can be unzipped manually using WinZip, but it takes longer to unzip than it takes the process to run. I have set up a button on a form that will look for the 'gz' files, butI cannot get the unzipping to work with the 'gz' files in VBA. I have contacted the company that set the 'gz' format, but they were less than helpful. Has anyone else come across this problem and know how to solve it? The code I am using to unzip files in other applications is as follows
--------------------------------------------------
pathzip = "C:\Program Files\Winzip"
If Dir(pathzip & "WinZip.exe") = "" Then
MsgBox "WinZip not found"
Exit Sub
End If
filnamzip = return_file 'returns selected gz file from
'FileDialog(msoFilePicker)
'this will eventually be automated
If filnamzip = "" Then Exit Sub
'--------------- find name of directory about to be created ----------
k = InStr(1, filnamzip, "\", 1)
Do While k <> 0
l = k
k = InStr(l + 1, filnamzip, "\", 1)
Loop
target = Right(filnamzip, Len(filnamzip) - l)
target = Left(target, Len(target) - 4)
If Dir(Left(filnamzip, Len(filnamzip) - 4), vbDirectory) <> "" Then
MsgBox "Directory " & target & " already exists" & vbLf & vbLf _
& " You must â & âdelete the existing directories first",
vbCritical + vbOKOnly, "Warning"
Exit Sub
End If
'------------ Destination path of unzipped file 'excluding last "\"---
destpath = Left(Me.Text9, Len(Me.Text9) -1)
shellstr = pathzip & "Winzip.exe" & " "
shellstr = shellstr & Chr(34) & filnamzip & Chr(34) & " " & Chr(34) _
& destpath & Chr(34)
RetVal = Shell(shellstr, 1)
DoEvents
--------------------------------------------------------
Any help would be much appreciated
|