Zip a File

<< Click to Display Table of Contents >>

Navigation:  Office and Office 365 >

Zip a File

Here I will show you a simple way to add a file to a zip file using Access VBA and WinZIp


Call ZipFile_FX("c:\", "c:\a.xls")


Private Sub ZipFile_FX(ZipFileName As String, fileToBeZipped As String)

  Const ZIPEXELOCATION = "c:\program files\winzip\winzip32.exe"

  Shell ZIPEXELOCATION & " -a " & Chr(34) & ZipFileName & Chr(34) & _

" " & Chr(34) &   fileToBeZipped & Chr(34), vbNormalFocus

End Sub

Command line parameters for WinZip

Winzip is one of the most popular programs on the planet and if you want to automate it, they recommend upgrading to Winzip Pro and installing the free command line utility. If you want to try command line parameters without upgrading to Winzip pro, try the commands on this page using Windows Start then the Run text box.   Read more here