I have a app that should create a excel spreadsheet and save it. The app works runs without any problems on other machines, including my bosses computer(he has the same ver of office and VS as me). I don't know if this is relevant but I have office 2013 and VS 2012. Edit I'm trying to save as a .xls (exel 97').
SNIPIT
public static bool XLSaveAs(ref Excel._Workbook oWBTemplate, string FileName)
{
System.IO.FileInfo x = new System.IO.FileInfo(FileName);
if (x.Exists)
{
try
{
x.Delete();
}
catch
{
MyControls.MsgFunctions.WarningMsg("Make sure " + FileName + " is not open.");
return false;
}
}
try
{
if(FileName.Contains(".xlsx"))
oWBTemplate.SaveAs(FileName);
else
//Error occurs here
oWBTemplate.SaveAs(FileName, Excel.XlFileFormat.xlExcel8);
}
catch
{
MyControls.MsgFunctions.WarningMsg("Unable to save " + FileName);
return false;
}
return true;
}
If I take out the try catch statement this is the error I get.
ERROR
COMException as unhandled
Exception from HRESULT: 0x800A03EC