Winzip encription from Access VBA

m_tibbit

New member
Local time
Today, 05:16
Joined
Aug 29, 2008
Messages
1
Hi,

I am working on database and need to add some code to create an excel spreasheet create a zip of the file and then encrypt using winzip 256-bit encryption and then email the file. Company guidelines state I have to use winzip encryption at this level.

I can create the excel file and have found code to zip using winzip but can find how to set the level of encryption. If anyone could help me it would be much appreciated

Thanks

Mike
 
I think you would need the Command Line AddOn for winzip to do this from VBA.

http://www.winzip.com/prodpagecl.htm

If you have that then I'd just look in the help file to see what arguments you need to pass to enable encryption.
 
I know it's an old post, but I was searching for something else and thought I'd add my bit. :)
I can't remember where I got this from but it is working well for us.
This is a little summary, but basically you should be able to follow what's happening. We copy a report, export it, call winzip, this is where unfortunately we have to use SendKeys, but it does work and prompts for the password to encrypt.
I hope this little idea can help out others.

Code:
DoCmd.CopyObject , Me.SelBP.Value & " Summary Report", acReport, "rptBP-LeadSheetWord"
    'DoCmd.CopyObject , Me.SelBP.Value & " Multis Report", acReport, "rptBP-MultisWord"
    DoCmd.OutputTo acOutputReport, Me.SelBP & " Summary Report", acFormatRTF, "C:\BPD\" & Me.SelBP & " Summary Report.rtf"
        
    Call ZipFile_FX("C:\BPD\" & Me.SelBP.Value & " Summary Report.zip", _
    "C:\BPD\" & Me.SelBP.Value & " Summary Report.rtf")
        
    DoCmd.DeleteObject acReport, Me.SelBP.Value & " Summary Report"
        
    If MsgBox("A Zip folder has been created called (" & Me.SelBP.Value & " Summary Report" & ".zip)" & Chr(13) & Chr(10) _
    & "Located in your C:\BPD folder." & Chr(13) & Chr(10) & "PLEASE REMEMBER TO ENCRYPT BEFORE SENDING", vbExclamation + _
    vbOKOnly, "ZIPPED") = vbOK Then
    
    Call Shell("""c:\program files\winzip\winzip32.exe""" & " " & """C:\BPD\" & Me.SelBP.Value & " Summary Report.zip""", vbMaximizedFocus)
    SendKeys "%(AY)"

Code:
Private Sub ZipFile_FX(ZipFileName As String, fileToBeZipped As String)
Const ZIPEXELOCATION = "c:\program files\winzip\winzip32.exe"
Shell ZIPEXELOCATION & " -a " & Chr(34) & ZipFileName & Chr(34) & " " & Chr(34) & fileToBeZipped & Chr(34), vbHide
End Sub
 

Users who are viewing this thread

Back
Top Bottom