'Office' does not exist in the namespace 'Microsoft'

Error: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Version: Microsoft Visual Studio 2013

Problem code:
using Excel = Microsoft.Office.Interop.Excel;

Solution:

1. Go to http://www.dllme.com/dll/files/microsoft_office_interop_excel_dll.html and download Microsoft.Office.Interop.Excel.dll (Size: 1.04 MB)


2. Right click on Project > Add > References


3. It will open Reference Manager window


4. Click on Browse button and select the downloaded .dll file


5. Now you can see the Microsoft.Office.Interop.Excel in References section

This C# error means the project is missing the reference for Microsoft Office interop. The Microsoft.Office.Interop.Excel namespace lives in an assembly that must be added before it can be used.

Adding the Office primary interop assembly reference, or installing it through NuGet, resolves it. Interop also requires the matching Office version to be installed wherever the code runs.

Comments

Popular posts from this blog

[Solved] Error: No such keg: /usr/local/Cellar/gcc

[How To] Unfollow Non-followers on Instagram