I am attempting to create an Excel spreadsheet in C#. I am using VSE 2010. I added a project reference to
Microsoft Excel 14.0 Object Library
and my using statements include
using Microsoft.Office.Interop.Excel;
however, this code gives an error “the type or namespace could not be found” for all the Excel. statements.
Is there anything else I need to be doing?
class excelsheet
{
private static void CreateWorkbook(string FileName)
{
Excel.Application xl = null;
Excel._Workbook wb = null;
Excel._Worksheet sheet = null;
//VBIDE.VBComponent module = null;
bool SaveChanges = false;
}
}
I’m assuming you are doing this:
Instead, try changing it to a using statement like: