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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

winzip via visual basic

Status
Not open for further replies.

twinmom

Programmer
Mar 22, 2002
4
US
I am currently running winzip in visual basic using SHELL. When I step through my application, I have no problems creating a zip file but when I simply run my application, it gives me a "52 - file not found error".

Does anyone have any idea why this is happening? I would appreciate any thoughts you might have. Thanks!
 
We'd need to see the code in question. Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Here is the code:
Code:
x = Shell("C:\program files\winZip\winZip32.exe -a " & "c:\Out.Zip c:\in1.txt c:\in2.txt c:\in3.txt"
[\code]
 
this line is fine to me.
any code after this shell command, which will access the newly-created zip file?

shell command is not blocking-call. The execution will go to next line right away.
 
You may need to add a loop, after the shell command, which checks to see if the file exists before continuing. I tend to use the scripting object to do this e.g.

dim blnFound as boolean
dim objFSO as scripting.FileSystemObject
set objFSO = new scripting.FileSystemObject

do until blnFound
blnFound = objFSO.FileExists("c:\Out.Zip")
loop

{code will now carry on}

You may find that you will want to link the check to a timer so that you check for the file once every 2 secounds or so instaed of using the loop, but that will depend on

a) how long it is likely to take to create the zip file.
b) how your code is structured

Andy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top