PDA

View Full Version : Solved: VBA to Zip a file



jo15765
03-27-2012, 11:44 AM
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?

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

I am trying to use 7zip to do the zipping

jo15765
03-27-2012, 11:57 AM
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