Excel Vba Zip File — With Password

' Check if 7-Zip exists If Dir(sevenZipExe) = "" Then MsgBox "7-Zip not found. Install from https://www.7-zip.org" Exit Sub End If

' Delete existing ZIP if present If Dir(outputZip) <> "" Then Kill outputZip excel vba zip file with password

Dim wsh As Object Set wsh = CreateObject("WScript.Shell") wsh.Run cmd, 0, True ' Check if 7-Zip exists If Dir(sevenZipExe) =

' --- Build command --- ' a = add, -tzip = zip format, -p = password, -mx=9 = max compression Cmd = """" & SevenZipPath & """ a -tzip """ & ZipFileName & """ """ & _ FileToZip & """ -p" & Password & " -mx=9 -y" -tzip = zip format