Namespace 'Excel"could not be found

Hi, error message was
" The type or namespace "Excel" could not be found( are you missing ua using directive or an assembly reference?)"
I did remove the reference "Microsoft/Office.Core" and add back. Initial the program was developed with MS Office 2003. Currently i using the same program in MS Office 2007.  

Still after add back i am facing the same error. Please do advice.
reference1.JPG
Rama TitoProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jdavistxCommented:
Do you have the correct using included in your code?

using Microsoft.Office.Core

Open in new window

Rama TitoProgrammerAuthor Commented:
After i include " using Microsoft.Office.core" the error still indicate the same.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Threading;
using System.Configuration;	
using System.Data.SqlClient;
using System.Globalization;
using System.Diagnostics;
using Microsoft.Office.Core;

Open in new window

jdavistxCommented:
Sorry, I should clarify.

I don't know where the Excel class exists.  Does it exist in Microsoft.Office.Core?  Apparently not.  That being said, are the libraries that are used for Excel interop functionality the same for 2003 and 2007?

It would appear as though the namespace to be used is:
Microsoft.Office.Interop.Excel

Open in new window


and I assume there's a Microsoft.Office.Interop reference you need to add.

From there, it may be the case that the Excel.Worksheet you have in your code is the result of declaring the using statement such as:

using Excel = Microsoft.Office.Interop.Excel

Open in new window


but I can't say for sure

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Miguel OzSenior Software EngineerCommented:
All excel classes like Workbook, Worksheet are defined at Microsoft.Office.Interop.Excel; you have to use:
 using Excel = Microsoft.Office.Interop.Excel
and you need to add the version 12  of this assembly as a reference(Excel 2007).
If your add reference dialog does not have it (as per my screenshot), you need to install Excel 2007PIA from:
http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&displaylang=en
excelref.jpg
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.