I get the Error - Retrieving the COM class factory...' at the line
Excel.Workbook wb = new Excel.Workbook.
Using VS2010, Windows 7 64 bit. I already set the Target platform to 'X(86)'.
using Microsoft.Office.Interop;
using Excel = Microsoft.Office.Interop.Excel;
protected void btnOpen_Click(object sender, EventArgs e)
{
OpenExcel();
}
private void OpenExcel()
{
Excel.Application app = new Excel.Application();
Excel.Workbook wb = new Excel.Workbook();
Excel.Worksheet ws = new Excel.Worksheet();
Excel.Range range = null;
app.visible = true;
wb = app.Workbooks.Add(1);
ws = wb.WorkSheets[1];
range = ws.get_Range("A1","A3");
ws.Cells[0,0]="Date";
ws.Cells[0,1]="Code";
ws.Cells[0,2]="Name";
}