Hi guys, trying to zip files at the click of a button in an access form, at the minute i've got it working for individual files but i can't get it to zip the entire contents of the folder in one zip folder.. Its ziping each individual txt file in its own zip file.
I'm hoping its something basic i've missed either that or im doing it completly wrong!
Here goes : -
Option Compare Database
Sub ZipFiles1()
Dim file As Variant
Const FILESOURCE = "C:\New Folder\"
Const FILEDEST = "C:\New Folder\ZIP\"
Const ZIPDIRPATH = "C:\Program Files\7-Zip\7z.exe"
For Each file In CreateObject("Scripting.FileSystemObject").GetFolder(FILESOURCE).Files
Shell ZIPDIRPATH & " a -tzip """ & FILEDEST & "\" & file.Name & ".zip"" """ & file.Path & """"
Next
End Sub
_________________________________________________________________
Thanks for your help!
I'm hoping its something basic i've missed either that or im doing it completly wrong!
Here goes : -
Option Compare Database
Sub ZipFiles1()
Dim file As Variant
Const FILESOURCE = "C:\New Folder\"
Const FILEDEST = "C:\New Folder\ZIP\"
Const ZIPDIRPATH = "C:\Program Files\7-Zip\7z.exe"
For Each file In CreateObject("Scripting.FileSystemObject").GetFolder(FILESOURCE).Files
Shell ZIPDIRPATH & " a -tzip """ & FILEDEST & "\" & file.Name & ".zip"" """ & file.Path & """"
Next
End Sub
_________________________________________________________________
Thanks for your help!