
Originally Posted by
ma201dq
Just wanted to mention that its got to be vbs rather than vb
I now have some code that zips a file, but how can i modify it such that it
1) it dynamially picks the file in the directroy to zip
2) passwords protect it using the name of the file
3) works with large files
here is the code:
Code:
Const FOF_CREATEPROGRESSDLG = &H0&
Const File1 = "C:\files\test.txt"
Const MyZip = "C:\files\test.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!"
Bookmarks