On Mon, 17 Apr 2006 17:01:02 -0700, Jonathan wrote in microsoft.public.outlook.program_vba:
"Michael Bednarek" wrote:
On Wed, 12 Apr 2006 17:31:02 -0700, Jonathan wrote in microsoft.public.outlook.program_vba:
"Michael Bednarek" wrote:
On Tue, 11 Apr 2006 12:50:01 -0700, Jonathan wrote in
microsoft.public.outlook.program_vba:
Hi, I have a procedure that finds a folder and then for each mail item with
an attachment saves the attachment. For attachments that are zip files I then
unpack them. Well attempt to...
I have downloaded winupzip.exe for this purpose and use the line:
intRet = shell("path\winupzip -o path\file.zip path\fileSaveName", vbHide)
When stepping through the code in debug mode this line does not cause any
errors. Yet does not have the desired result.
intRet does return a non-zero value. However, I don't know where to find the
description for this value.
There is no such program (winupzip).
What exactly did you put into Shell()? Not what you showed in your post,
I presume. Note that path names should be unambigous, i.e. they should
be complete. E.g.: d:\dir\file.ext, not dir\file.
What happens when you run the Shell() with vbNormalFocus? What happens
when you run that command from a CLI?
Hi Michael, runnig shell with vbnormalfocus does not improve things.
The code I'm using is:
****** code start *****
[snip]
*****code end *****
Using the debug window the variable strZipCommandLine contains...
"c:\windows\system32\cmd.exe" "C:\Program Files\WinZip\wzunzip.exe"
"C:\Solution\Mail Merge - many items for each record.zip"
"C:\Solution\ZipTest.doc"
If the attachment is not a zip file then the process works.
The command line follows the syntax given in the winzip help file.
No it doesn't:
wzunzip [options] zipfile [@listfile] [[drive:][\][path][\]] [files...]
Note that files are unqualified names; the target directory is an
optional parameter just before files.
Also: you don't need to invoke CMD to execute a program (wzunzip), but
if you do, you have to include the /c or /k switch.
There is no need to ofuscate the code with Chr(34) - just use two
quotes where you want to include a quote in the string.
Testing the return value of Shell() as a boolean should never
return False. The Shell function "Runs an executable program and
returns a Variant (Double) representing the program's task ID if
successful, otherwise it returns zero."
strFileDestination = "ZipTest.doc"
strZipCommandLine = """C:\Program Files\WinZip\wzunzip.exe"" -o """ _
& strZipFile & """ C:\Solution " & strFileDestination
The above is not tested, but the one below is:
strCmdLine = """C:\Program Files\WinZip\wzunzip.exe"" -o " _
& "C:\Temp\Default\Test.zip C:\Temp\Default ttt.vbs"
Hi Michael, hope that you had a great Easter Break... smile
Using your example above I have tried the following
strZipCommandLine = """C:\Program Files\WinZip\WZUNZIP.exe"" -o " _
& "O:\PriceLists_Practice\Test\CDPricing.zip
O:\PriceLists_Practice\Test\CDPricing.xls"
'extract zip file
Debug.Print "command line: " & vbNewLine & strZipCommandLine
Shell strZipCommandLine, vbHide
Unfortunitely, without success.
Any further ideas or suggestions :-)
Read the documentation for WzUnzip; construct a command line that
works from a command line window (e.g. CMD); transport that working
command line into your VBA code.
I believe your version still doesn't use WzUnzip's last and
second-to-last parameters properly. From WzUnzip's Help:
wzunzip [options] zipfile [@listfile] [[drive:][\][path][\]] [files...]
As I wrote befo
Note that files are unqualified names; the target directory is an
optional parameter just before files.
--
Michael Bednarek
http://mbednarek.com/ "POST NO BILLS"