Open a Password-Protected Excel 2016 Workbook with OleDbConnection
Question details
The user needs to query a password-protected Excel 2016 workbook from a VB.NET application using OleDbConnection.
- Product
- Microsoft Excel 2016 and Microsoft ACE OLE DB 12.0
- Device & OS
- not provided
- Scenario
- A VB.NET application connects to an Excel workbook through the Microsoft.ACE.OLEDB.12.0 provider.
- Observed behavior
- The workbook password is not accepted through the OleDbConnection string.
Confirm that you have permission to access the workbook and know its password. Have the exact connection error and a sanitized version of the connection string available; remove passwords and other sensitive information before sharing them.
Check the workbook protection and request VB.NET developer support
Use these checks to distinguish workbook protection from a provider or connection-string issue before asking for help.
Open the workbook in Excel 2016 and enter the password if prompted. Check File > Info > Protect Workbook to help determine whether the file requires a password to open; worksheet or workbook-structure protection is a different issue.
In Visual Studio, locate the OleDbConnection string and capture the exact exception message. Note the workbook format, provider name, and application platform target shown in the project's Build properties.
Visit https://developercommunity.visualstudio.com/ and search for the error or create a question. Include the sanitized connection string, exact error, protection type, provider version, and application platform target, but do not post the password.

Work with Excel Workbooks in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Excel file compatibility for an easier move between office suites. It does not fix ACE OLE DB connection-string or VB.NET provider issues.

Frequently Asked Questions
Is a password to open a workbook the same as worksheet protection?
No. A password required when opening the file is different from protection that restricts changes to a worksheet or workbook structure. Open the file in Excel and check File > Info > Protect Workbook to help identify its protection.
Why doesn't my Excel password work in the OleDbConnection string?
Excel's ability to open a workbook with a password does not mean the ACE provider accepts that password through the connection string. Capture the exact exception and protection type, then ask for guidance in the Visual Studio Developer Community.
What should I include in a developer support question?
Include the exact error message, a sanitized connection string, the workbook format and protection type, the ACE provider version, and the application's platform target from Visual Studio's project Build properties. Do not share the password.
Will WPS Office fix the ACE OLE DB connection?
No. WPS Office is an alternative for working with compatible spreadsheet files, but ACE OLE DB connection and VB.NET provider issues require developer troubleshooting.




