none
Cannot create an instance of Excel 2016 in Visual Studio 2015 RRS feed

  • Question

  • I have Visual Studio 2015 and my application is for .NET Framework 4.0.

    I installed Microsoft Office Home&Buissness 2016 and trying tocreate an instance using this code: Microsoft.Office.Interop.Excel.Application excelAppTemplate = new Microsoft.Office.Interop.Excel.Application();

    but I get this error:

    Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).

    I am referencing Microsoft.Office.Interop.Excel 15.0.0.0. While searching for answers, I have seen a solution to delete this registry key:

    HKEY_CLASSES_ROOT\TypeLib{00020813-0000-0000-C000-000000000046}

    But I have 1.9 and not the previous version like 1.8 or 1.7, just 1.9. Is there any new version for Office 2016?

    Tuesday, April 5, 2016 9:33 AM

Answers

  • Hi liranGFI,

    >> am referencing Microsoft.Office.Interop.Excel 15.0.0.0.

    Do you install multiple Office version in your computer? How did you refer Excel 15.0? In my option, Excel 15.0 is for Office 2013, and for Excel 2016 is 16.0. I suggest you right click your project, add reference, Com tab, and select Microsoft Excel 16.0 Object Library.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, April 7, 2016 7:26 AM

All replies

  • Hi IiranGFI,

    This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Regards,

    Emi Zhang
    TechNet Community Support


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, April 7, 2016 5:35 AM
  • Hi liranGFI,

    >> am referencing Microsoft.Office.Interop.Excel 15.0.0.0.

    Do you install multiple Office version in your computer? How did you refer Excel 15.0? In my option, Excel 15.0 is for Office 2013, and for Excel 2016 is 16.0. I suggest you right click your project, add reference, Com tab, and select Microsoft Excel 16.0 Object Library.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, April 7, 2016 7:26 AM