0

While trying to create a Instance of new Microsoft.Office.Interop.Word.Application I am getting error as below.

try
{
    Console.WriteLine("Begin.");
    Application wordApp = new Microsoft.Office.Interop.Word.Application { Visible = false };
    Console.ReadLine();
}

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

I have tried the solutions suggested in Microsoft Office Interop Error also noticed StackOverflow question with no ans's.

I have Installed the Primary Interop Assemblies Redistributable and Visual Studio 2010 Tools for Office Runtime (vstor_redist).

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
Shubh
  • 6,693
  • 9
  • 48
  • 83
  • When and how does your app run? – Dmitry Streblechenko Feb 10 '20 at 13:56
  • It was not running in server machine but even when I am trying to run a console app its throwing error. – Shubh Feb 10 '20 at 14:01
  • Does this answer your question? [System.UnauthorizedAccessException: Retrieving the COM class factory for Word Interop fails with error 80070005](https://stackoverflow.com/questions/1491123/system-unauthorizedaccessexception-retrieving-the-com-class-factory-for-word-in) – Ian Kemp Feb 10 '20 at 14:13
  • The error is pretty specific: the user doesn't have permission to access the Registry to retrieve the COM class list. – Ian Kemp Feb 10 '20 at 14:13
  • What does your project have to do with VSTO? It does not appear to be VSTO so why would you install the two things mentioned? They are only for VSTO projects. – Cindy Meister Feb 10 '20 at 17:51
  • The Office applications *must be installed and licensed* on the machine where the code is running. Is that the case? – Cindy Meister Feb 10 '20 at 17:52
  • @IanKemp I have tried most of the suggestions, I will give a try again. – Shubh Feb 11 '20 at 09:17
  • @CindyMeister Somewhere it was suggested installing VSTO, so I thought of giving a try. Yes office is installed in the machine.. – Shubh Feb 11 '20 at 09:18

0 Answers0