Wednesday, September 23, 2015

'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