[AccessD] Archiving files with Winzip Command Line version

Mcgillivray, Don [ITS] donald.a.Mcgillivray at mail.sprint.com
Wed Mar 9 13:02:43 CST 2005


Andy,

That would work, except that in actual practice I'm *adding* files to an
existing archive, named according to the date the files are added to it.
So, the zip may legitimately exist before starting the archive, and I
can't kill it.

Thanks for the input, though.

Cheers!
Don

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Wednesday, March 09, 2005 10:37 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Archiving files with Winzip Command Line version


Don
You could use Dir in a loop to test for the zip existing. You'd have to
Kill
the file before too. Then set a time limit and drop out of the loop if
the
zip still didn't exist after that time.

-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Mcgillivray, Don [ITS]
> Sent: 09 March 2005 17:41
> To: AccessD
> Subject: [AccessD] Archiving files with Winzip Command Line version
> 
> 
> Hello, All
> 
> In my app I'm archiving text files via VBA using the Winzip 
> command line and the ShellWait function I got from Dev 
> Ashish's web site.  It works well, but I need to be able to 
> validate that the zip succeeds before moving on to the next 
> step in my code.  I've been experimenting with a sample I 
> found that uses the Windows Script Host.  Passing my Winzip 
> command line string to it causes the process to hang.  (The 
> same string passed to ShellWait works in a flash.)  I tried 
> it using a command line string for "Blat" to send a test 
> email, and that worked as expected - no hang.  A code sample 
> is below.  Am I overlooking something?  Has anybody a better 
> solution for this requirement?
> 
> Thanks!
> 
> Don
> 
> Function GetErrorLevel()
>   Dim wsShell As Object, Proc As Object, strCommand As 
> String, strErrLevel As String
>   Dim strZipFileName As String, strTargetFile as String, 
> strWinzipPath as String
>   
>   strWinzipPath = "C:\Archive\Winzip\WZZIP"
>   strZipFileName = "C:\Archive\TestZipFile.zip"
>   strTargetFile = "C:\Data\DM02TEST.txt"
> 
>   strCommand =  strWinzipPath & " -a " & """" & 
> strZipFileName & """" & " " & """" & strTargetFile & """"
> 
>   'Testing command line using ShellWait
>   'ShellWait strCommand, vbHide
>   
>   Set wsShell = CreateObject("wscript.shell")
>   Set Proc = wsShell.Exec(strCommand)
> 
>   Do While Proc.Status = 0
>      DoEvents 'Yields execution so that the operating system 
> can process other events
>   Loop
> 
>   'Use proc.ExitCode to check for returned %errorlevel%
>   strErrLevel = "StdOut=" & Proc.StdOut.ReadAll()
>   strErrLevel = strErrLevel & Chr(13) & Chr(10) & "ExitCode=" 
> & Proc.ExitCode
> 
>   MsgBox (strErrLevel)
> 
>   Set wsShell = Nothing
>   Set Proc = Nothing
> 
> End Function
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list