Create compressed folder and password protect the excel file

aman

Registered User.
Local time
Today, 14:43
Joined
Oct 16, 2008
Messages
1,251
Hi there

The following code works fine but now my client wants me to store the excel file in compressed(Zipped) folder and it should be password protected automatically. So what additions do I need to make in the below code.

Code:
strsql = "SELECT * FROM tblcustomer where Proj_No=" & J & ""
ID,Projectref,Dept,Tname,PNo,Title,FName,MName,SName,Add1,Add2,Add3,Pcode,DOB,NINO,StoreDateTime,username FROM tblcustomer where Proj_No=" & J & ""
If DCount("Name", "MSysobjects", "Name='qrytemp' and type=5") > 0 Then
DoCmd.DeleteObject acQuery, "qrytemp"
End If
Set qdf = CurrentDb.CreateQueryDef("qrytemp", strsql)
    Dim objXls As Excel.Application
    Dim objWrkBk As Excel.Workbook
    Dim xprtFile As String
     
   xprtFile = "J:\P" & J & "-Sent" & ".xls"
    
     DoCmd.OutputTo acOutputQuery, "qrytemp", acFormatXLS, xprtFile

Thanks
 

Users who are viewing this thread

Back
Top Bottom