Re: Invoke Command Line (Shell Method with Winzip)
- From: "chris.nebinger@xxxxxxxxx" <chris.nebinger@xxxxxxxxx>
- Date: 27 Jul 2006 07:48:36 -0700
I've not used the command line add-in, but I suspect your problem is
one of spaces.
Your line: Shell (zipIT & target & source)
Will get transferred to the command window as:
C:\Winzip\wzzip -a c:\test.zipc:\test.xls
If wzzip is expecting:
C:\winzip\wzzip -a c:\test.zip c:\test.xls
then you need to add spaces. Also, if there are any spaces in the name
of the target or source (which is common with My Documents, then they
need quotes:
C:\winzip\wzzip -a "C:\Documents and Settings\User\My
Documents\Target.Zip" "C:\Documents and Settings\User\My
Documents\Source.xls"
Which would be fixed in your code as:
'Air Code coming---->
Function Zip (Target as String, Source as String)
Dim strShell as String
strShell = "C:\Winzip\wzzip -a"
'chr(32) = space
'chr(34) = "
strShell = strShell & chr(32) & chr(34) & target & chr(34) & chr(32) &
chr(34) & source & chr(34)
Shell strShell
End Function
Chris Nebinger
ABAX via AccessMonster.com wrote:
First - thanks for taking the time to read. Here is my situation. I am
trying to call WinZip from my VBA module. I have the macro creating a
spread*** and want RunCode macro to simply take the XLS file and turn to
Zip. I have WinZip Pro and the command line add-in. I have tried it from
the run command line and it works. What's the deal? After looking below -
you will probably realize that I am relatively new to VBA. Your help is
greatly appreciated.
Two methods I have tried:
1)Function winZipit(ByVal source As String, ByVal target As String, ByVal zip
As Boolean)
zipIT = App.Path & "wzzip -a"
unzipIT = App.Path & "wzunzip -e "
If zip = True Then
Shell (zipIT & target & source)
Else: Shell (unzipIT & target & source)
End If
End Function
2) Public Function ZipFile()
Shell ("C:\Program Files\WinZip\WZZIP.EXE -a" & "C:\Test.zip" & "C:\Test.xls")
End Function
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200607/1
.
- References:
- Invoke Command Line (Shell Method with Winzip)
- From: ABAX via AccessMonster.com
- Invoke Command Line (Shell Method with Winzip)
- Prev by Date: Re: Remove or Delete a User-defined Property
- Next by Date: Re: Could it be possible to create stored procedure in Access 2003
- Previous by thread: Invoke Command Line (Shell Method with Winzip)
- Next by thread: Problem with code to Import from Word
- Index(es):