Click here to Skip to main content
14,699,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I cannot find this reference in the list provided.

What I have tried:

I right click on "References" The Reference Manager pops up. I cannot find Microsoft.Office.Interop.Excel in any of the tabs.
Posted
Updated yesterday

First, you have to have Office installed on the machine.

Next, you go into References -> right-click -> Add Reference -> click on the COM tab. In the list, look for "Microsoft Office version Object Library". Put a check mark next to that and click OK.

If you are writing an ASP.NET / MVC / Windows Service app, do not bother doing this. Office is not supported in these types of applications.
   
v2
Comments
Fred Andres 10-Jan-20 10:19am
   
Thanks for the help Dave. I added Microsoft Office 12, 14, and 16 Object Library and I still don't see Microsoft.Office.Interop.Excel in the references. My app is a plain old .NET console app.
Fred Andres 10-Jan-20 13:13pm
   
I just found it. It's under Microsoft Excel 16 Object Library. But thanks for pointing me in the right direction.
Member 14861679 yesterday
   
I thought COM is old stuff. I would think VS would dim it if the project is using a current NET framework. I found another way of finding DLLs. In the Reference Manager Browse (at bottom) and go to C:Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0...\dll file. The GAC is supposed to provide DLLs for the run machine. But what if I want to target an older version of Excel?
Dave Kreskowiak yesterday
   
Those .DLL's are not the Office code. They are wrappers around the Office COM interfaces.

In any case, you still need Office installed on the machine.
Member 14861679 yesterday
   
In a VS (Community) project I added a reference to Excel. (1) I browsed to Windows etc. as mentioned above. In Solution Explorer it shows as Microsoft.Office.Interop.Excel. (2) I then added a second reference by using Reference Manager and selected COM Microsoft Excel 16 Object Library. In Solution Explorer it shows as Microsoft.Office.Interop.Excel1. The properties of these are different except the Path for both are Identical: the path to C:Windows\assembly. I don't understand "wrappers" but Microsoft should explain what's going on when people use their products, especially when changes are made in each release.
Dave Kreskowiak yesterday
   
Those "wrappers" are .NET code that handles the translations and calls between your .NET code and the COM code. That code is automatically generated so you don't have to go through the tedious pain of writing it yourself.
Another way to do it:
In Reference Manager, use Browse... (at the bottom) to find the DLL file:
C:Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0...\
Microsoft.Office.Interop.Excel.dll
Add

With new releases, this may change.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900