help to open pwd Excel from Access

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

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
 
...
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.

--
 
Back
Top