Guys,
I need zip and password protect a file. I have a directory in which a file will be placed on a daily basis. I need vb code that zips and password protects the zipped filed. the zipped file will inherit the unzipped file name. the file name will be the password.
I need this code for windows server 64bit or 32 bit. I need to run it from a scheduled task.
Unfortunately my vb is crap so I’m not sure how to code it.
thanks
ma201dq:
Guys,
I need zip and password protect a file. I have a directory in which a file will be placed on a daily basis. I need vb code that zips and password protects the zipped filed. the zipped file will inherit the unzipped file name. the file name will be the password.
I need this code for windows server 64bit or 32 bit. I need to run it from a scheduled task.
Unfortunately my vb is crap so I’m not sure how to code it.
thanks
Just wanted to mention that its got to be vbs rather than vb
ma201dq
January 19, 2013, 10:32pm
3
I now have some code that zips a file, but how can i modify it such that it
it dynamially picks the file in the directroy to zip
passwords protect it using the name of the file
works with large files
here is the code:
Const FOF_CREATEPROGRESSDLG = &H0&
Const File1 = "C:\\files\ est.txt"
Const MyZip = "C:\\files\ est.zip"
CreateObject("Scripting.FileSystemObject") _
.CreateTextFile(MyZip, True) _
.Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
'-------------- zip ---------------------------
'get ready to add files to zip
With CreateObject("Shell.Application")
'add files
.NameSpace(MyZip).CopyHere File1, FOF_CREATEPROGRESSDLG
.NameSpace(MyZip).CopyHere File2
End With
wScript.Sleep 1000
wscript.echo "Done!"