I am trying to use Access VB to open an excel file and encrypt it then close it. The code will open the file, and I am using SaveAs to apply a Password, these work without issue. However when using .SetPasswordEncryptionOptions it doesn't seem to do anything. I don't get any error, but when I open the excel file to confirm the change, it hasn't been set.
Any help on how to make this work would be great. TIA
Any help on how to make this work would be great. TIA
Code:
Dim xlExcelApp As Excel.Application
Dim xlWorkbook As Excel.Workbook
Set xlExcelApp = New Excel.Application
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
Set xlWorkbook = xlExcelApp.Workbooks.Open(FileName, 0, True)
xlWorkbook.SetPasswordEncryptionOptions "Microsoft Enhanced Cryptographic Provider v1.0", "RC4", 128, True
xlWorkbook.SaveAs FileName2, , Password