Zip a file through VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Back
Top