Read from an Ecxwl Spreadsheet using c#
Hi all,
I am trying to read data from an excel spreadsheet using c#.
My operating system is Windows XP Professional. I have Office 2003 installed on my system.
I have added microsoft excel object 11.0 as reference to my c# project . But i get an error that the excel object is not recognised. Please help.
The code looks like this.
private Excel.Application ExcelObj = null;
public Form1()
{
// Initialize the Windows Components
InitializeComponent();
ExcelObj = new Excel.Application();
// See if the Excel Application Object was successfully constructed
if (ExcelObj == null)
{
MessageBox.Show("ERROR: EXCEL couldn't be started!");
System.Windows.Forms.Application.Exit();
}
// Make the Application Visible
ExcelObj.Visible = true;
}