Subject: Unzipping gz files
Posted By: elansolutionsltd Post Date: 1/3/2006 7:13:46 AM
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


Reply By: AccessMaster Reply Date: 1/21/2006 2:55:08 AM
Are you using the WinZip Command Line Support Add-On?

If not, this is your problem with getting WinZIP to work from VBA.

It is available at www.winzip.com

Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com

Go to topic 39002

Return to index page 389
Return to index page 388
Return to index page 387
Return to index page 386
Return to index page 385
Return to index page 384
Return to index page 383
Return to index page 382
Return to index page 381
Return to index page 380