I'm attempting to export 2 queries from an Access database to 2 tabs in an Excel workbook. I want that workbook to be password-protected. I'm having difficulty making it password protected in VBA. Here's my VBA so far:
Public Function ExportToExcel()
Call DoCmd.TransferSpreadsheet(TransferType:=acExport, _
TableName:="q1_Get_Load_Data", _
FileName:="C:\Users\...\POPs_Reports.xlsx")
Call DoCmd.TransferSpreadsheet(TransferType:=acExport, _
TableName:="q2_Number_by_Alpha", _
FileName:="C:\Users\...\POPs_Reports.xlsx")
End Function
Is there a way to add code to make the workbook password protected?