Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    27

    Unanswered: VBA to run zip on exported file

    Could anyone tell me the code to have in either access or excel to have a specified file zipped up to a specified name.

    The syntax in a .bat file for the zip is as follows:

    "c:\progra~1\winzip\wzzip c:\temp\207.zip c:\temp\207.xls"

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    you can use the shell function to execute external programs, a simple utility sub would look like this:

    Code:
    Private Const cstrWinZipPath As String = "c:\progra~1\winzip\wzzip"
    
    Public Sub ZipFile(ByVal vstrFileToZip, ByVal vstrZipFile)
        shell cstrWinZipPath & " """ & vstrZipFile & """ """ & vstrFileToZip & """"
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •