Re: How add password to ZIP folder?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks Ron ! I look out for updates to your website.


"Ron de Bruin" wrote:

Hi Leel

I never test it but ii will not be easy
When I update the site to my new site format I will try a few things

Btw there is a new NewZip macro on my site
http://www.rondebruin.nl/windowsxpzip.htm




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"LeeL" <LeeL@xxxxxxxxxxxx> wrote in message news:402F86E8-0937-4BF2-842B-3C0039DFD155@xxxxxxxxxxxxxxxx
Thanks, that one gets close, but it is calling a winzip application from c
drive. I am trying to run on my company network and cannot call wizip...,
below code in my first post does work, it seems like there should be a way
add a line for pasword ... ?
--
Thanks & Best Regards


"JLGWhiz" wrote:

This site might be more helpful.

http://www.developerfusion.co.uk/show/2043/

"LeeL" wrote:

Thanks, I familiar with the manual way to add, can anyone help with how to
get it done inside VBA code?

--
Thanks & Best Regards


"JLGWhiz" wrote:

This site explains how to do it manually.

http://support.microsoft.com/kb/306531

"LeeL" wrote:

Hi, i have been using code below to zip files. Can someone help add a line
to add a password to the zip folder? I am zipping text files, so i cannot
password the files . . .
Thanks in advance!

Sub Zip_File()
Dim strDate As String, DefPath As String
Dim oApp As Object
Dim FName, FileNameZip

'********************************************************************
'These values are user inputs which can be loaded in a number of ways
DefPath = "H:\"
FName = "H:\Temp\PSR31M.TXT"
strDate = Format(Now, " dd-mmm-yy h-mm-ss")
FileNameZip = DefPath & "MyFilesZip " & strDate & ".zip"


If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If

'Create empty Zip File
NewZip (FileNameZip)

Set oApp = CreateObject("Shell.Application")

oApp.Namespace(FileNameZip).CopyHere FName

MsgBox "You find the zipfile here: " & FileNameZip
Set oApp = Nothing
End Sub
Sub NewZip(sPath)
'Create empty Zip File
Dim oFSO, arrHex, sBin, i, Zip
Set oFSO = CreateObject("Scripting.FileSystemObject")
arrHex = Array(80, 75, 5, 6, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
For i = 0 To UBound(arrHex)
sBin = sBin & Chr(arrHex(i))
Next
With oFSO.CreateTextFile(sPath, True)
.Write sBin
.Close
End With
End Sub

Sub newone()
Dim strDate As String, DefPath As String
Dim oApp As Object
Dim FName, FileNameZip

'********************************************************************
'These values are user inputs which can be loaded in a number of ways
DefPath = "H:\"
FName = "H:\Temp\PSR31M.TXT"
strDate = Format(Now, " dd-mmm-yy h-mm-ss")
FileNameZip = DefPath & "MyFilesZip " & strDate & ".zip"


If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If

'Create empty Zip File
NewZip (FileNameZip)

Set oApp = CreateObject("Shell.Application")

oApp.Namespace(FileNameZip).CopyHere FName

MsgBox "You find the zipfile here: " & FileNameZip
Set oApp = Nothing
End Sub


.



Relevant Pages