Solved

Excel could not be found - missing assembly reference?

Posted on 2011-09-07
3
314 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
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

839 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