Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel could not be found - missing assembly reference?

Posted on 2011-09-07
3
Medium Priority
?
320 Views
Last Modified: 2012-05-12
Hi, I did get this error in my error list while compiling the project. Previously the project are done with MS Office Excel 2003, and currenlty i am using Excel 2007. In my system i don't have MS office 2003. In my project, my references i did add Excel and Microsoft.Office.Core.

The error is ->
The type or namespace name 'Excel' could not be found (are you missing a using directive or an assembly reference?)      

private int findColumnDept(Excel.Worksheet Ws)

Error was underline in "Excel"

private int findColumnDept(Excel.Worksheet Ws)
		{
		
			int no=1;
			string CellValue="";
			int retryCount=0;
			bool EmptyCellAllowed=true;
			do 
			{
				//listBox1.Items.Add(worksheet.getCells[i,1].ToString());
					
				Excel.Range range1 = Ws.get_Range( "A"+no, "A" + no);
				no++;	
					
					
				
				if (range1.Cells.Value2!=null)
				{
					CellValue=range1.Cells.Value2.ToString().Trim();
					EmptyCellAllowed=false;

				}
				else
				{
					retryCount++;
					CellValue="";
					if (retryCount>15)
					{
						EmptyCellAllowed=false;
						no=0;		
					}
					
				
				}
			}while ((CellValue.Length>0)||(EmptyCellAllowed)) ;
			

			return no-1;

		}

Open in new window

0
Comment
Question by:TITO2009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 2000 total points
ID: 36500995
0
 

Author Comment

by:TITO2009
ID: 36501024
Hi, i did manage to solve after

using Excel = Microsoft.Office.Interop.Excel;

Thank you.
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 36501030
glad to help you
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 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