none
Excel 2016 get intance of running excel aaplication RRS feed

  • Question

  • Hello,

    In the past i used the next code to get acces to the running excel application

    using Microsoft.Office.Interop.Excel;

    varExApp = (Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject("Excel.Application");


    Now we are using office 365 (excel 2016)

    The code code doenst work anymore instead of using the file version 15.0.0.0 of the file

    Microsoft.Office.Interop.Excel

    What am i doing wrong?

    Thursday, December 21, 2017 9:53 AM

All replies

  • Hello,

    I failed to reproduce your issue. I could use the code to get a running excel application instance.

    What do you mean the code doesn't work anymore? Did you get any error message?

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, December 22, 2017 2:44 AM
  • Hello thank you for the quick answer

    I've got the next error message

    "Can not convert COM object of the type .__ ComObject to interface type Microsoft.Office.Interop.Excel.Application. This operation failed because the QueryInterface call to the COM component for the interface with IID {000208D5-0000-C000-000000000046} failed due to the following error: Interface is not registered (HRESULT exception: 0x80040155)"

    Best Regards

    Friday, December 22, 2017 7:14 AM
  • Hi a,

    I am wondering whether you lauch Excel application and your C# project under the same permisison.

    In other words, if you lauch Excel with Administrator, you will need to Run c# projet under administrator two, otherwise, you will receive exception.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 22, 2017 7:29 AM