Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need coding in vba to password protect .zip files

Status
Not open for further replies.
Jan 9, 2022
1
IN
Hello all, I need help with working code where i have a zip file and inside that file i have a .csv file. I already have a macro where the csv files are zipped and then send to clients via email. I need a macro code where the zipped files can be password protected with different types of passwords and those files can be sent to the clients. Currently only zipped files are sent with no protection. Can anyone help me...?? Thanks in advance.This will help me a lot.


 
I did a similar task, but on a non-Windows system without Vbscript: The specified CSV should be zipped with the password.
I just used the zip command:
Code:
[b]zip -P [i]password[/i] [i]resulting_archive[/i].zip [i]data_file[/i].csv[/b]
 
The command I posted above is for Info-ZIP. I used it on unix like system but it's multi platform. I haven't tried it yet on windows, but it seems to be available here (the file zip30.zip):
Other multi platform utility very often used on windows is 7-zip available here: To pack CSV-file into password protected ZIP archive could be done using the following command:
Code:
[b]7za a -p[i]password[/i] [i]resulting_archive[/i].zip [i]data_file[/i].csv[/b]
 
I am not aware of any automatable ZIP applications, and the Windows shell's built-in zip capability doesn't provide the ability to password protect zip files, so Mikrom's solution is about as good as you'll get (although the exact command will depend on which zip tool you are using).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top