Excel/Outlook/Access - Zip files/folders optionally wtih password and size of zip parts.
In this example files and folders from given directory will be zipped with password or not.
Additionally archive can be divided into parts with given size f.e. in MB.
If needed 7zip programm: http://www.7-zip.org
and some 7ZIP command's instuctions: https://sevenzip.osdn.jp/chm/cmdline/switches/index.htm
Sub zip()
Const SOURCE = "C:\YourFolder" 'input path of your folder FROM which folder and files will be zipped
Const DEST = "C:\YourFolder" 'input path of your folder TO which folder and files will be zipped
Zip7Path = "C:\Program Files\7-Zip\7z.exe" 'install 7-zip and input path to exe file
Password = "YourPassword" ' if needed set your password
For Each fold In CreateObject("Scripting.FileSystemObject").GetFolder(SOURCE).subfolders
'pick the method of zipping with:
'zipCommand = Zip7Path & " -v2m" & " -p" & Password & " a -tzip """ & DEST & "\" & fold.Name & ".zip"" """ & fold.path & """" ' pass & 2MB parts
'zipCommand = Zip7Path & " -p" & Password & " a -tzip """ & DEST & "\" & fold.Name & ".zip"" """ & fold.path & """" 'pass
zipCommand = Zip7Path & " a -tzip """ & DEST & "\" & fold.Name & ".zip"" """ & fold.path & """" 'just zip
Shell zipCommand
Next
End Sub
Sub unzip()
Call Shell("cmd /k cd c:\YourFolder\DestinySubFolder && c:\""Program Files""\7-Zip\7z.exe x C:\SourceFlder\YourZipFile.zip", vbNormalNoFocus)
End Sub