![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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. -- Many thanks Jonathan Parminter |
#2
|
|||
|
|||
![]()
Am Tue, 11 Apr 2006 12:50:01 -0700 schrieb Jonathan:
Jonathan, what is about the support for WinZip? Obviously that is not an Outlook issue at all :-) -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- 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. |
#3
|
|||
|
|||
![]()
Hi Michael, you're right this is not an outlook issue. I just thought that
this maybe something that others had experienced and had a solution... Regards, Jonathan "Michael Bauer" wrote: Am Tue, 11 Apr 2006 12:50:01 -0700 schrieb Jonathan: Jonathan, what is about the support for WinZip? Obviously that is not an Outlook issue at all :-) -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- 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. |
#4
|
|||
|
|||
![]()
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? -- Michael Bednarek http://mbednarek.com/ "POST NO BILLS" |
#5
|
|||
|
|||
![]() "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? -- Michael Bednarek http://mbednarek.com/ "POST NO BILLS" Hi Michael, runnig shell with vbnormalfocus does not improve things. The code I'm using is: ****** code start ***** strFileDestination = "C:\Solution\ZipTest.doc" 'cPriceListPath & GetSupplierValue("saved as") If Dir(strFileDestination, vbNormal) "" Then 'Rename as _backup intLen = Len(strFileDestination) - 3 strFileDestinationBkUp = Left(strFileDestination, intLen - 1) & _ "_backup" & Mid(strFileDestination, intLen) Name strFileDestination As strFileDestinationBkUp End If 'Check whether attachment is a zip file If Right(.FileName, 3) = "zip" Then ' strZipFile = cPriceListPath & .FileName strZipFile = "C:\Solution\" & .FileName 'Check whether an existing zip file at this location If Dir(strZipFile, vbNormal) "" Then 'remove file Kill strZipFile End If 'save to destination location and name .SaveAsFile (strZipFile) 'Create zip exe command line to extract file to destination location and name strZipCommandLine = Chr(34) & cWinupZip & Chr(34) & Space(1) & _ Chr(34) & strZipFile & Chr(34) & Space(1) & _ Chr(34) & strFileDestination & Chr(34) 'extract zip file If Not Shell(strZipCommandLine, vbHide) Then MsgBox "Unzip error" End If 'otherwise, save attachment to destination location and name Else .SaveAsFile (strFileDestination) End If *****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. Many Thanks Jonathan |
#6
|
|||
|
|||
![]()
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 ***** strFileDestination = "C:\Solution\ZipTest.doc" 'cPriceListPath & GetSupplierValue("saved as") If Dir(strFileDestination, vbNormal) "" Then 'Rename as _backup intLen = Len(strFileDestination) - 3 strFileDestinationBkUp = Left(strFileDestination, intLen - 1) & _ "_backup" & Mid(strFileDestination, intLen) Name strFileDestination As strFileDestinationBkUp End If 'Check whether attachment is a zip file If Right(.FileName, 3) = "zip" Then ' strZipFile = cPriceListPath & .FileName strZipFile = "C:\Solution\" & .FileName 'Check whether an existing zip file at this location If Dir(strZipFile, vbNormal) "" Then 'remove file Kill strZipFile End If 'save to destination location and name .SaveAsFile (strZipFile) 'Create zip exe command line to extract file to destination location and name strZipCommandLine = Chr(34) & cWinupZip & Chr(34) & Space(1) & _ Chr(34) & strZipFile & Chr(34) & Space(1) & _ Chr(34) & strFileDestination & Chr(34) 'extract zip file If Not Shell(strZipCommandLine, vbHide) Then MsgBox "Unzip error" End If 'otherwise, save attachment to destination location and name Else .SaveAsFile (strFileDestination) End If *****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" -- Michael Bednarek http://mbednarek.com/ "POST NO BILLS" |
#7
|
|||
|
|||
![]()
Michael, thanks friend I'll give it a go when I return to work after the
Easter break. fyi, I have got into the habit of using chr(34) as I get Togan names that can include several apostraphys and have found the chr(34) bound strings handles any number of apostraphys. So I just use chr(34) everywhere grin I included the return value and cmd in a 'try everything' approach to get it working.. -- Many thanks Jonathan Parminter "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 ***** strFileDestination = "C:\Solution\ZipTest.doc" 'cPriceListPath & GetSupplierValue("saved as") If Dir(strFileDestination, vbNormal) "" Then 'Rename as _backup intLen = Len(strFileDestination) - 3 strFileDestinationBkUp = Left(strFileDestination, intLen - 1) & _ "_backup" & Mid(strFileDestination, intLen) Name strFileDestination As strFileDestinationBkUp End If 'Check whether attachment is a zip file If Right(.FileName, 3) = "zip" Then ' strZipFile = cPriceListPath & .FileName strZipFile = "C:\Solution\" & .FileName 'Check whether an existing zip file at this location If Dir(strZipFile, vbNormal) "" Then 'remove file Kill strZipFile End If 'save to destination location and name .SaveAsFile (strZipFile) 'Create zip exe command line to extract file to destination location and name strZipCommandLine = Chr(34) & cWinupZip & Chr(34) & Space(1) & _ Chr(34) & strZipFile & Chr(34) & Space(1) & _ Chr(34) & strFileDestination & Chr(34) 'extract zip file If Not Shell(strZipCommandLine, vbHide) Then MsgBox "Unzip error" End If 'otherwise, save attachment to destination location and name Else .SaveAsFile (strFileDestination) End If *****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" -- Michael Bednarek http://mbednarek.com/ "POST NO BILLS" |
#8
|
|||
|
|||
![]() "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 ***** strFileDestination = "C:\Solution\ZipTest.doc" 'cPriceListPath & GetSupplierValue("saved as") If Dir(strFileDestination, vbNormal) "" Then 'Rename as _backup intLen = Len(strFileDestination) - 3 strFileDestinationBkUp = Left(strFileDestination, intLen - 1) & _ "_backup" & Mid(strFileDestination, intLen) Name strFileDestination As strFileDestinationBkUp End If 'Check whether attachment is a zip file If Right(.FileName, 3) = "zip" Then ' strZipFile = cPriceListPath & .FileName strZipFile = "C:\Solution\" & .FileName 'Check whether an existing zip file at this location If Dir(strZipFile, vbNormal) "" Then 'remove file Kill strZipFile End If 'save to destination location and name .SaveAsFile (strZipFile) 'Create zip exe command line to extract file to destination location and name strZipCommandLine = Chr(34) & cWinupZip & Chr(34) & Space(1) & _ Chr(34) & strZipFile & Chr(34) & Space(1) & _ Chr(34) & strFileDestination & Chr(34) 'extract zip file If Not Shell(strZipCommandLine, vbHide) Then MsgBox "Unzip error" End If 'otherwise, save attachment to destination location and name Else .SaveAsFile (strFileDestination) End If *****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" -- Michael Bednarek http://mbednarek.com/ "POST NO BILLS" 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 :-) Many thanks Jonathan |
#9
|
|||
|
|||
![]()
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" |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
open contacts through command line | gary | Outlook - Using Contacts | 1 | March 29th 06 09:26 PM |
Command line to add contacts | cderner | Outlook - Using Contacts | 2 | March 24th 06 11:00 PM |
Outlook 2003 Command Line Switches | jb | Outlook - General Queries | 2 | March 17th 06 07:49 PM |
Outlook Shutdown - command line | Pete | Outlook - Installation | 1 | February 7th 06 09:28 PM |
Outlook command-line switches | Brad Nowlin | Outlook - General Queries | 1 | January 27th 06 06:00 PM |