ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help to open pwd Excel from Access (https://www.excelbanter.com/excel-programming/302791-help-open-pwd-excel-access.html)

ed

help to open pwd Excel from Access
 
I want to open an Excel file in 'read-only' with a password:

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim sfilename As String

'This works fine
sfilename = "noPassword.xls"
Set db = DBEngine.OpenDatabase(sfilename, _
False, True, "Excel 8.0")

'This does not work
sfilename = "hasPassword.xls"
Set db = DBEngine.OpenDatabase(sfilename, _
False, True, "Excel 8.0;PWD=123")

I get this error message:
Run time error 3161
Could not decrypt file
--
Ed



Jamie Collins

help to open pwd Excel from Access
 
"Ed" wrote ...

I want to open an Excel file in 'read-only' with a password:

I get this error message:
Run time error 3161
Could not decrypt file


As the error message suggests, adding a password encrypts the workbook
on disk. The Excel UI is require to decrypt. See:

Microsoft Knowledge Base Article - 211378
XL2000: "Could Not Decrypt File" Error with Password Protected File
http://support.microsoft.com/?KBID=211378

Jamie.

--


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com