{“Exception from HRESULT: 0x800A03EC”} at Microsoft.Office.Interop

menexceegecit

New Member
I am trying to create an excel file using the below code in an ASP.Net web applcation.
The code works normally when I run from visual studio, but an exception occur workbook.Close command when I deploy the application on IIS and run the deployed version.\[code\]Excel.Application exc = null;try{ exc = new Excel.Application(); Excel.Workbooks workbooks = exc.Workbooks; Excel._Workbook workbook = workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet); Excel._Worksheet worksheet = (Excel._Worksheet)workbook.Worksheets[1]; Excel.Range range = worksheet.get_Range("A1", System.Reflection.Missing.Value); Object[] data = http://stackoverflow.com/questions/7008096/new Object[] {"" }; range.GetType().InvokeMember("Value", System.Reflection.BindingFlags.SetProperty, null, range, data); workbook.Close(true, p_sTempFileName, null);}catch (Exception ex){ Console.WriteLine(ex.Message + "\n" + ex.InnerException); Console.ReadLine();}finally{ if (exc != null) exc.Quit();}\[/code\]
 
Top