Solved

Excel could not be found - missing assembly reference?

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
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…

758 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

20 Experts available now in Live!

Get 1:1 Help Now