'Interop' does not exist in the namespace 'Microsoft.Office'
-
Friday, November 02, 2007 9:37 PM
Using Visual Studio 2005 I create a new Visual C#->Office->2003 Add-ins->Excel Add-in Project.
I Build it and get the error:
"The type or namespace name 'Interop' does not exist in the namespace 'Microsoft.Office' (are you missing an assembly reference?)"
This is on the line:
using Excel = Microsoft.Office.Interop.Excel;
It can't find the "Interop" part.
I've downloaded and installed "Office XP PIAs" (and "Microsoft.Office.Interop.Excel" is in my c:\WINDOWS\assembly directory)
Within the solution Explorer I dropdown the References section and see "Excel" with a yellow "!" next to it.
I removed it, then added the COM Reference "Microsoft Excel 11.0 Object Library". Excel show up again (this time without the yellow "!").
I rebuild it and get the same errors.
Can anyone help me? I seem to be going round and round here and am probably just missing some simple step.
Thanks!
All Replies
-
Friday, November 02, 2007 10:04 PM
Isn't that how it always works? I figured out my own problem only after asking for help...
The problem is that I had the 2002 Office XP PIAs loaded instead of the 2003s.
Hope this helps someone else out there with a similar problem.
-
Friday, November 02, 2007 10:06 PM
Hi danwel,
I believe you donwloaded the wrong version of the PIA's. Office 2003 is what coresponds to version 11 (Office XP is earlier).
The following article should help you:
Installing and Using the Office 2003 Primary Interop Assemblies
http://msdn2.microsoft.com/en-us/library/aa159923(office.11).aspx
-
Thursday, January 24, 2008 3:00 PM
Hi,
the problem was solved for me when i add AddReference->.NET->
Microsoft.Office.Interop.Excel.
kindly
dinu.selva
chennai
-
Friday, June 04, 2010 4:03 PM
I had to do the same thing (add the .NET->Microsoft.Office.Interop.Excel reference). But, I also had to remove the Excel and Microsoft.Office.Core references, otherwise, the .NET Interop reference conflicts with the other Excel references.
Thanks for the help everyone.--mzappit
-
Saturday, May 28, 2011 5:02 AMHay Danwel Palesh Here Thanks For Helping Us ..........Palesh

