Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2006, 08:13 AM
Authorized User
 
Join Date: Jul 2004
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default 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


 
Old January 21st, 2006, 03:55 AM
Friend of Wrox
 
Join Date: Jul 2005
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating Excel FIles from resource Files abinashpatra ASP.NET 1.0 and 1.1 Basics 0 July 28th, 2008 02:07 AM
compare 2 files and output third files mtnguye6 VBScript 0 April 14th, 2008 11:03 AM
jsp files and html files jamara ASP.NET 2.0 Basics 1 November 20th, 2006 07:03 AM
.php files vs .html files pbuongiovanni PHP How-To 2 January 5th, 2006 04:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.