locked
Microsoft Word API RRS feed

  • Question

  • Hello,

    I have Office 365 installed on my machine. Particularly MS Word version is 2012.

    I have created C# project (VS 2019) and referenced microsoft word 16.0 object. It appeared as C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Office.Interop.Word\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Word.dll.

    at that following code

    Application application = new Application();
    var document = application.Documents.Open(args[0])

    throws

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

    exception. I have checked \HKEY_CLASSES_ROOT\Wow6432Node\Interface\{0002096B-0000-0000-C000-000000000046}\TypeLib registry entry and it is empty (my machine is 64 bit).

    I tried to run my executable on other machines but  got the same error. Please advise.

    Thanks.

    Saturday, December 5, 2020 9:51 PM

Answers

  • forum migrated to mentioned below forum 

    https://docs.microsoft.com/en-us/answers/index.html

    please mark as answer if issue resolved

    • Marked as answer by gregoms Monday, December 7, 2020 5:54 PM
    Sunday, December 6, 2020 10:01 AM