Hi there,
I am not sure if you can do that directly with VBA. There may be some third party COM components that can do zipping.
What you could do is use the WinZip command line add on. This add on supports zipping and unzipping from the command line. Together with a WScript.Shell object, you can zip from within VBA code. Here's a small example:
Code:
Dim objShell
Set objShell = CreateObject("wscript.shell")
' Zip file with command-line WInZip
Dim ReturnValue
ReturnValue = objShell.Run("C:\winnt\system32\cmd.exe /C c:\wzzip.exe -a MyFileName.zip MyFileToZip.doc", 1, True)
If you have a registered version of WinZip, you can download the add on here:
http://www.winzip.com/wzcline.htm
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.