Solved

Excel could not be found - missing assembly reference?

Posted on 2011-09-07
3
316 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

705 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