0

When I try to open a Word file using Interop it will be applied to the System.Runtime.InteropServices.COMException error (0x800A13E9): Word has encountered a problem.

code:

 Word.Application app = new Word.Application();
 app.Visible = true;
  var doc = app.Documents.Open(@"C:\Temp\test.docx");
  //..... do something
  doc.Close(false);
  app.Quit();

The fall is on the "app.Documents.Open()" function. I tried to add Desktop Folder in "C:\Windows\SysWOW64\config\systemprofile" , update in registery and in Component Services but it does not help. The same code works on win7 computer but does not work on win10. And when I try to open Excel file via interop it is opened correctly with the same settings.

I would be happy to help, thank you

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
Shrd
  • 11
  • 5
  • you need to make sure you use the correct version of the primary interop assemblies (PIA) for your OS and Office versions: https://learn.microsoft.com/en-us/visualstudio/vsto/how-to-install-office-primary-interop-assemblies?view=vs-2017 apart from that, it would help if you could include relevant parts of your code and version informations of the components involved. – Cee McSharpface Nov 11 '18 at 12:00
  • 0x800A makes it an application-specific error, convert 0x13E9 to find the right google query "microsoft word error 5097". Lots and lots of hits. But surely you'll discover that a snippet of the code that fails is pretty important to get help here. – Hans Passant Nov 11 '18 at 12:18
  • Possibly, it's a permissions problem with the `Temp` directory. Can you open a file from another, trusted folder? (Trusted, as in File/Options/Trust Center/Settings/Trusted Locations) Also: which version of **Word** is involved, here? – Cindy Meister Nov 11 '18 at 16:57
  • Possible duplicate of [Exception from Word.ApplicationClass.Activedocument all of a sudden](https://stackoverflow.com/questions/54073785/exception-from-word-applicationclass-activedocument-all-of-a-sudden) – ibrahim mahrir Mar 24 '19 at 02:03

0 Answers0