Click here to Skip to main content
12,948,566 members (63,025 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 9-Mar-10 19:40pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Rate this: bad
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.
Rate this: bad
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.
Rate this: bad
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

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,419
CHill60 3,275
Maciej Los 2,778
Jochen Arndt 1,935
ppolymorphe 1,795

Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 23 Mar 2016
Copyright © CodeProject, 1999-2017
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