Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line WinZip 1

Status
Not open for further replies.

AlexCuse

Programmer
Apr 13, 2006
5,416
US
Hi all,

(This was posted on the Access other topics forum, but I realized this might be a better place. Please let me know if you have any ideas.)

I am trying to automate the zipping of output files using winzip's command line support add on. While testing, I have it set to print the string I'm sending to the shell. I take this string and run it in the shell manually, and it works fine. However, Access is having trouble sending it to the shell. Here is some of my code, let me know if you have any ideas.



Code:
filedate = (DateAdd("d", -1, Date))
fnamedate = Format(filedate, "mmddyy")
fname = fnamedate & "apps1a"
fdir = "S:\File\Directory\"

c0 = """C:\Program Files\WinZip\wzzip.exe"""
c1 = fdir & fname & ".zip"
c2 = fdir & fname & ".pdf"
zipper = c & c0 & " " & c1 & " " & c2


(code to create pdf file)


Call Shell(zipper)

MsgBox "Application File Created and Zipped"

Any help is greatly appreciated.

Thanks a lot,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
What is c ?
Access is having trouble sending it to the shell
Which trouble ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry, I got rid of C as I was posting this. I had tried using an additional quotation mark around the entire string.

I am having trouble identifying the trouble because the sub appears to complete successfully, only the .zip file is not in directory.

Thanks for the quick response,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
I have tried using both a modified version of SendKeys and a modified shell command called "Shell and Wait" found on mvps.org, but I am still having no luck getting this to work. Has anyone had success using WinZip's command line add-on (I'm sure someone must have, but has anyone here?).

I am also wondering if this could be a problem with my OS, as I have recently started having much more trouble with command-line FTP scripting. Let me know what you think.

Thanks for your time,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
How arew ya AlexCuse . . .

. . . and this:
Code:
[blue]   Dim filedate As Date, fnamedate As String, fname As String
   Dim c0 As String, c1 As String, c2 As String
   Dim fdir As String, zipper As String, [purple][b]DQ[/b][/purple] As String
   
   [purple][b]DQ[/b][/purple] = """"
   filedate = (DateAdd("d", -1, Date))
   fnamedate = Format(filedate, "mmddyy")
   fname = fnamedate & "apps1a"
   fdir = "S:\File\Directory\"
   
   c0 = [purple][b]DQ[/b][/purple] & "C:\Program Files\WinZip\wzzip.exe" & [purple][b]DQ[/b][/purple]
   c1 = [purple][b]DQ[/b][/purple] & fdir & fname & ".zip" & [purple][b]DQ[/b][/purple]
   c2 = [purple][b]DQ[/b][/purple] & fdir & fname & ".pdf" & [purple][b]DQ[/b][/purple]
   zipper = c0 & " " & c1 & " " & c2
   
   [green]'code to create pdf file[/green]

   Call Shell(zipper)

   MsgBox "Application File Created and Zipped"[/blue]

Calvin.gif
See Ya! . . . . . .
 
Ah, I needed to place double quotes around each individual piece of the string instead of around the whole thing. I'm sure in some strange way it makes sense...

I also ended up having to add a message box before the shell call because it seemed to be running before .pdf creation was finished. Thanks Ace, you da man! You too PH.

Thanks again,

Alex



It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top