Cannot open Excel file in C#

后端 未结 4 1764
天涯浪人
天涯浪人 2021-02-19 21:51

I have the following C# function in my project, which is supposed to open and return an existing Excel workbook object:

Application _excelApp;

// ...

private W         


        
4条回答
  •  名媛妹妹
    2021-02-19 22:04

    I had this issue today.

    Surprisingly, it seems that the error occurred when the application was run as Administrator.

    After we moved to Windows 10, some things (mainly related to IIS) would only work if running Visual Studio as Administrator, so it quickly became a habbit to start VS as Administrator.

    The solution was to NOT run the application as Administrator.

    This might be related to how our work environments are set up, but I thought it was worht sharing, if anyone else experiences the same issue, and the other solutions don't work for them either.

提交回复
热议问题