help to open pwd Excel from Access

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
 
J

Jamie Collins

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

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top