Troubleshoot Excel Workbook.Queries.Add in a Visual Studio Add-in
Question details
The user needs help accessing Excel Workbook.Queries.Add from a Visual Basic .NET Excel Interop add-in.
- Product
- Microsoft Excel and Visual Studio Excel Interop
- Device & OS
- not provided
- Scenario
- A developer wants to add a Power Query to an Excel workbook from a Visual Studio add-in.
- Observed behavior
- Workbook.Queries.Add may be unavailable through Interop or fail at runtime, although equivalent VBA code works.
Identify whether Queries.Add is missing in Visual Studio or fails when the add-in runs. Collect the exact error and a small code example that reproduces the issue.
Ask Microsoft Excel developers for help with the Interop call
Use this approach for specialized assistance with the Excel add-in and Power Query API.
In Excel, open File > Account > About Excel to find the Office version. In Visual Studio, open Help > About Microsoft Visual Studio and note the Visual Studio version; also check the project's .NET target and Interop references.
In Visual Studio, copy the relevant VB.NET code that calls Workbook.Queries.Add and include the complete error message. If available, include the equivalent VBA code that works.
Go to Microsoft Q&A or the Microsoft Excel Developer forum and create a question about the Excel Interop add-in. Include the version and reference details, code, and whether the problem occurs in the editor or at runtime.
Work with Excel files 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 the Microsoft Excel Interop add-in issue.

Frequently Asked Questions
Why does Workbook.Queries.Add work in VBA but not in my VB.NET add-in?
The cause cannot be determined from that difference alone. Share both code examples, the referenced Interop assemblies, Office and Visual Studio versions, and the exact error with the Microsoft Excel Developer forum or Microsoft Q&A.
Where can I find my Excel version?
In Excel, open File > Account > About Excel and include the displayed version details in your support question.
What should I report if Queries.Add fails at runtime?
Include the complete runtime error, the VB.NET call and surrounding code, the Office and .NET versions, and the Excel Interop references. State whether the equivalent VBA code succeeds.
Can WPS Office fix an Excel Interop add-in?
No. WPS Office can be used as an alternative for common spreadsheet tasks, but it does not fix Microsoft Excel Interop. Check compatibility separately before relying on Excel add-ins or Power Query automation in WPS.




