Others

Open a Password-Protected Excel 2016 Workbook with OleDbConnection

Rana GarciaRana Garcia Nov 20, 2026 868 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Check how the workbook is protected

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.

2
Record the connection details

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.

3
Ask the developer community

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.

Check the workbook protection and request VB.NET developer support
Password handling depends on the connection: A password that opens a workbook in Excel is not necessarily accepted as a connection-string property by the ACE provider. The exact error and protection type are important for identifying the appropriate approach.
Free Microsoft Office alternative

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.

Open and edit spreadsheets in a familiar interfaceCompatible with Microsoft Excel formats such as XLSX and XLSWork with workbook data without writing a database queryUse a free, lightweight office suite
microsoft office alternative - wps office

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.