Solved

C# error " The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)"

Posted on 2011-02-14
5
1,034 Views
Last Modified: 2012-05-11
I get the error message

 The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

when I attempt to run the C# code from my page.  I have already included the reference to the Micorosft.Office.Excel namespace in my code, which is why I am confused.
0
Comment
Question by:melli111
  • 3
5 Comments
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34889600
It could be due to lack of proper assembly. You may have older version.
Try download from here and refer it in your project
http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en
0
 
LVL 15

Author Comment

by:melli111
ID: 34890246
I am using Office 2007, with the .xlsx extension.  This link appears to be for Office 2002, and the file I am using is for Office 2007.  Will thi slink be suitable for this case?
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34890306

Check in your GAC for the exact assembly name?

I assume, it would be
Micorosft.Interop.Office.Excel
instead of
Micorosft.Office.Excel

Try
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34890332
In your namespace also check with the help of intellisense for
Microsoft.
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 500 total points
ID: 34890383
Have you added the appropriate Microsoft.Office.Interop... references to your project?
Untitled.png
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now