打开excel文件报错!!!
Excel.Application app=new Excel.ApplicationClass();
if (app == null)
{
statusBar1.Text = "ERROR: EXCEL couldn't be started!";
return ;
}
app.Visible = true;
app.UserControl = true;
Excel.WorkbookClass workbook =(Excel.WorkbookClass) app.Workbooks.Add("c:\\t1.xls");
Excel.WorksheetClass worksheet=(Excel.WorksheetClass)workbook.Sheets.get_Item(0)///这里错误,该怎么改???
if(worksheet==null)
{
statusBar1.Text = "ERROR: worksheet == null";
return;
}
Excel.Range range1=worksheet.get_Range("A1","A5");