I'm creating Excel like following:
class Program
{
private Excel.Application app = null;
private Excel.Application worksheet = null;
private Excel.Application workbook = null;
private Excel.Application worksheet_range = null;
//public Program()
//{
// CreateExcelDoc();
//}
static void Main(string[] args)
{
Program obj = new Program();
obj.CreateExcelDoc();
}
public void CreateExcelDoc()
{
try
{
app = new Excel.Application();
if (app == null)
return;
app.Visible = true;
workbook = app.Workbooks.Add(1);////error in this,saying "can not convert from Excel.Workbook to Excel.Application"
}
catch (Exception ex)
{
throw new Exception("CreateExcelDoc: Error" + ex.Message);
}
}
}
Could anyone pl tell where I'm going wrong? Note: I'm following this: http://msdn.microsoft.com/en-us/library/ms173186%28v=vs.80%29.aspx
Please send me any nice link/solution. I'm using Windows 7 64-bit OS.
Thanks.
workbookand what type do you declare it as?