Tuesday, February 11, 2014

.Net solving error: Call was rejected by callee

If your program uses MS Office Application Interop (e.g. Microsoft.Office.Interop.Word.Document) to procedure documents , sometimes you may get this following error:
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))

It happens only in few documents and the others will not. To solve this problem, we have 2 ways:

Way 1: Turn off all grammar / spelling functions, for example: open MS Word and go to Options, uncheck options:
+Check spelling as you type
+Use contextual spelling
+Mark grammar errors as you type
+Check grammar with spelling

Way 2: if you develop the program, you can add some codes to turn off grammar / spelling functions, for example in C#:
CurrentDocument.ShowGrammaticalErrors = false;
CurrentDocument.ShowRevisions = false;
CurrentDocument.ShowSpellingErrors = false;

Hope you save a tablet for headache.
Subscribe to RSS Feed Follow me on Twitter!