Hi
Does anyone using the code below know how to set a pwd on the file
b4 I winzip it or pwd protect the zipped file?
Thanks
Code:Sub Zip_Files_in_Folder(filename) Dim FileNameZip, FolderName Dim strDate As String, DefPath As String Dim oApp As Object 'DefPath = Application.DefaultFilePath If Right(DefPath, 1) <> "\" Then DefPath = DefPath & "\" End If FolderName = "N:\DailyFiles\QuoteAndBuy\ZippedFiles\" '<< Change strDate = Format(Now, " dd-mmm-yy") FileNameZip = FolderName & "MyFilesZip" & strDate & ".zip" 'Create empty Zip File NewZip (FileNameZip) Set oApp = CreateObject("Shell.Application") 'Copy the files to the compressed folder oApp.NameSpace(FileNameZip).CopyHere filename 'Keep script waiting until Compressing is done On Error Resume Next Do Until oApp.NameSpace(filename).Items.Count = _ oApp.NameSpace(filename).Items.Count 'Application.Wait (Now + TimeValue("0:00:01")) Loop On Error GoTo 0 msgbox "You find the zipfile here: " & filename End Sub




Reply With Quote