Consulting

Results 1 to 2 of 2

Thread: Solved: VBA to Zip a file

  1. #1
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location

    Solved: VBA to Zip a file

    I am trying to write some VBA that will backup a folder. I have this code, and it goes through the motions acting as if it works, but there is no output. can someone tell me what the issue is with my code, or provide code that will do this task?
    [vba]
    Sub Attempt()
    Dim ZipFileLocation As String
    Dim ZipName As String
    Dim ZipSaveLocation As String
    Dim SourceFileLocation As String
    Dim ZipInfo As String

    ZipFileLocation = "C:\Program Files\7-Zip\7z.exe"
    ZipName = "Backup.zip"
    ZipSaveLocation = "T:\Backup\Zips\"
    SourceFileLocation = "C:\Daily\Files\"
    ZipInfo = ZipSaveLocation & ZipName

    Shell ZipFileLocation & ZipInfo & SourceFileLocation
    End Sub
    [/vba]
    I am trying to use 7zip to do the zipping
    Last edited by Aussiebear; 03-27-2012 at 03:27 PM. Reason: adjusted the code tags for the correct usage

  2. #2
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location
    Thanks to all who viewed, I just found my solution! I wasn't patient enough as google came through for me. Anyone interested in doing this, I found the answer here:
    http://excelexperts.com/Zip-Files-from-Excel

Posting Permissions

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