Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi Friends
 
I am stuck up with a problem.I would be grateful to you people if anyone of you help mein solving my problem.
 
Actually I want to invoke an Excel application through my C# .Net program.For that I added the
 
using Excel= Microsoft.Office.Interop.Excel;
 
For that I did as below-->
 
My application->RC->Add Referenece->COM->Microsoft Excel 12.0 Object Library.
 
I did not find Microsoft.Office.Interop.Excel;
 
Now at Complie time I am getting a error as-->
 
The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
 
Am I missing anything or doing something wrong?
Can anybody help me for solving this problem??
 
Thanking in Advance.
 
Swapnil Borkar
(Software Trainee)
Posted 9-Mar-10 20:12pm
Edited 9-Mar-10 20:40pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

AddReference->.NET->
Microsoft.Office.Interop.Excel.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You need also to add a reference to the Microsoft Office 12.0 Object Libray, for the base support for office interop. See this article[^] for more information.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I don't think you want to add a reference to the COM library if you're using C#. You want the Primary Interop Assemblies, but you'll have to check the MSDN documentation for where to find them. I think their presence also depends on the version of Visual Studio you're using (I don't think the Express editions include them, for example).
 
A good place to start might be creating an Office plug-in project in Visual Studio and seeing what the references end up being.
 
Altenrativly, have a look in Object Browser to see what namespace the Excel Object Library has been put in. Be warned, however, that this is not the recommended way of doing things.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Add the "Microsoft.Office.Interop.Excel.dll" to your C# project reference from the following path
 
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Excel.dll
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

If using Ofice 2013 & Visual Studio 2013
 
then add reference assembly
Microsoft.Office.Interop.Excel
use version 15
 
getting the same error today and solved it
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 Sergey Alexandrovich Kryukov 189
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 24 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100