Error using Interop to open Excel in c#

0

when I use Interop to open an Excel file using this code

Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
app.Visible = false;
Workbook wb = app.Workbooks.Open(ruta,Type.Missing  ,false);
Worksheet sh = wb.Sheets["Scenarios"];

I got the following error.

`An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred
Additional information: El servidor lanzó una excepción. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))`

But if instead putting app.Visible = false I use app.Visible=true everything works perfectly.

Why is that error? obviously what I want is open an excel file but without showing the window so the user doesn't see all the back-end process

c#
excel
interop
asked on Stack Overflow Jun 15, 2016 by a.ras2002

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0