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 19:12pm
Edited 9-Mar-10 19: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

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

  Print Answers RSS
0 OriginalGriff 428
1 Sergey Alexandrovich Kryukov 253
2 PhilLenoir 115
3 RajeeshMenoth 110
4 Peter Leow 100
0 Sergey Alexandrovich Kryukov 6,465
1 OriginalGriff 5,926
2 CPallini 2,473
3 Richard MacCutchan 1,687
4 Abhinav S 1,540


Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 24 May 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