Zip a file through VBA

M

MCyn

Would somone out there know how to fill in these string variables in the code
below? I found it here in the forum and tried it last night but I'm not sure
what goes in what string variables (strZipPath, strFoxProPath, strZipFile) If
someone could please shed some light on the problem, I'd appreciate it. I am
currently trying to zip an excel spreadsheet (file is called "TestFile.xls")
so I can e-mail. The current file is 27 mb, and when I try to e-mail as is,
the file gets stuck e-mailing cause the file is too large.

intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If
 
J

JaRa

HI,

I wouldn't do it through the shell, i would make a reference to an object
library which handles zips.

From windows xp is standard in the OS though I don't know which API takes
care of this. I mainly use Dzip32.dll and Dunzip32.dll.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top