C# - word interop throw “System.Runtime.InteropServices.COMException (0x800A13E9): Word has encountered a problem.”









up vote
0
down vote

favorite












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:Temptest.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:WindowsSysWOW64configsystemprofile" , 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










share|improve this question























  • you need to make sure you use the correct version of the primary interop assemblies (PIA) for your OS and Office versions: docs.microsoft.com/en-us/visualstudio/vsto/… apart from that, it would help if you could include relevant parts of your code and version informations of the components involved.
    – dlatikay
    Nov 11 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 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 at 16:57














up vote
0
down vote

favorite












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:Temptest.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:WindowsSysWOW64configsystemprofile" , 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










share|improve this question























  • you need to make sure you use the correct version of the primary interop assemblies (PIA) for your OS and Office versions: docs.microsoft.com/en-us/visualstudio/vsto/… apart from that, it would help if you could include relevant parts of your code and version informations of the components involved.
    – dlatikay
    Nov 11 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 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 at 16:57












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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:Temptest.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:WindowsSysWOW64configsystemprofile" , 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










share|improve this question















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:Temptest.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:WindowsSysWOW64configsystemprofile" , 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







c# ms-word office-interop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 16:47









Cindy Meister

13.5k101934




13.5k101934










asked Nov 11 at 11:58









Shrd

114




114











  • you need to make sure you use the correct version of the primary interop assemblies (PIA) for your OS and Office versions: docs.microsoft.com/en-us/visualstudio/vsto/… apart from that, it would help if you could include relevant parts of your code and version informations of the components involved.
    – dlatikay
    Nov 11 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 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 at 16:57
















  • you need to make sure you use the correct version of the primary interop assemblies (PIA) for your OS and Office versions: docs.microsoft.com/en-us/visualstudio/vsto/… apart from that, it would help if you could include relevant parts of your code and version informations of the components involved.
    – dlatikay
    Nov 11 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 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 at 16:57















you need to make sure you use the correct version of the primary interop assemblies (PIA) for your OS and Office versions: docs.microsoft.com/en-us/visualstudio/vsto/… apart from that, it would help if you could include relevant parts of your code and version informations of the components involved.
– dlatikay
Nov 11 at 12:00





you need to make sure you use the correct version of the primary interop assemblies (PIA) for your OS and Office versions: docs.microsoft.com/en-us/visualstudio/vsto/… apart from that, it would help if you could include relevant parts of your code and version informations of the components involved.
– dlatikay
Nov 11 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 at 12:18




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 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 at 16:57




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 at 16:57

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248502%2fc-sharp-word-interop-throw-system-runtime-interopservices-comexception-0x800%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248502%2fc-sharp-word-interop-throw-system-runtime-interopservices-comexception-0x800%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3