Developers community number 1 connection string reference

What's the Connection String for Excel 2007 Macro enabled workbook when it is protected

Posted 2011-07-13 01:52
by Sam Zheng
in the Excel Forum
I found the useful connection string to access to Excel 2007 Macro enabled workbook.

Here is the connection string

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\report.xlsm;Extended Properties='Excel 12.0 Macro;HDR=YES'

I am a .NET developer, I used OleDbConnection to access the workbook. It works when the workbook is not protected.

However, if the workbook is protected by a password, then it shows "External table is not in the expected format".

I tried to append the password to the string, then it becomes
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\report.xlsm;Extended Properties='Excel 12.0 Macro;HDR=YES';Password=112233

When the program runs, it displays the message "Cannot start your application. The workgroup information is missing or opened exclusively by another user."

Does anyone knows the connection string to Excel 2007 Macro enabled workbook when it is protected by a password?

Thanks,
Copyright © 2012 ConnectionStrings.com   |   All Rights Reserved   |   Powered by CSAS   |   Send feedback, articles, requests and more connection strings here.