R
Ramesh
Hi,
I working on windows application where i have a task to create a new excel
workbook(either 2003 or 2007 based on the users selection) and move data from
different some other excel files, do some formatting and then save the
workbook.
My client has both excel 2003 and 2007 installed on his machine, but has
2003 as default which he needs for some other application.
My application is working fine when i am generating the 2003 workbooks but
giving error when i am trying to generate the 2007 workbook. The following is
the code snippet i am using for the task
xl.Application xlAppl = new xl.Application();
xlAppl.DisplayAlerts = false;
xlAppl.ScreenUpdating = false;
xlAppl.Visible = false;
xlAppl.DefaultSaveFormat = (xl.XlFileFormat)51;
xl.Workbook xlWb = (xl.Workbook)(xlAppl.Workbooks.Add(obj));
//I moving the data and formating ...
//and save the final
if (strExcelVersion ==
xfrmMain.dictApplicationSettings[ApplicationSettings.EXCEL_VERSION_2003])
{
xlWb.SaveAs(strFlatExcelPath,
xl.XlFileFormat.xlWorkbookNormal, obj, obj, false, false,
xl.XlSaveAsAccessMode.xlNoChange, false, false, obj, obj, obj);
}
else if (strExcelVersion ==
xfrmMain.dictApplicationSettings[ApplicationSettings.EXCEL_VERSION_2007])
{
xlWb.SaveAs(strFlatExcelPath,
xl.XlFileFormat.xlOpenXMLWorkbook, obj, obj, false, false,
xl.XlSaveAsAccessMode.xlNoChange, false, false, obj, obj, obj);
}
I get the following error: Exception from HRESULT: 0x800A03EC
Can anyone please help me solve this problem!!
Thanks,
Ramesh
I working on windows application where i have a task to create a new excel
workbook(either 2003 or 2007 based on the users selection) and move data from
different some other excel files, do some formatting and then save the
workbook.
My client has both excel 2003 and 2007 installed on his machine, but has
2003 as default which he needs for some other application.
My application is working fine when i am generating the 2003 workbooks but
giving error when i am trying to generate the 2007 workbook. The following is
the code snippet i am using for the task
xl.Application xlAppl = new xl.Application();
xlAppl.DisplayAlerts = false;
xlAppl.ScreenUpdating = false;
xlAppl.Visible = false;
xlAppl.DefaultSaveFormat = (xl.XlFileFormat)51;
xl.Workbook xlWb = (xl.Workbook)(xlAppl.Workbooks.Add(obj));
//I moving the data and formating ...
//and save the final
if (strExcelVersion ==
xfrmMain.dictApplicationSettings[ApplicationSettings.EXCEL_VERSION_2003])
{
xlWb.SaveAs(strFlatExcelPath,
xl.XlFileFormat.xlWorkbookNormal, obj, obj, false, false,
xl.XlSaveAsAccessMode.xlNoChange, false, false, obj, obj, obj);
}
else if (strExcelVersion ==
xfrmMain.dictApplicationSettings[ApplicationSettings.EXCEL_VERSION_2007])
{
xlWb.SaveAs(strFlatExcelPath,
xl.XlFileFormat.xlOpenXMLWorkbook, obj, obj, false, false,
xl.XlSaveAsAccessMode.xlNoChange, false, false, obj, obj, obj);
}
I get the following error: Exception from HRESULT: 0x800A03EC
Can anyone please help me solve this problem!!
Thanks,
Ramesh