I create text documents from templates (.dot) through Microsoft.Office.Interop.Word. The code below works on some templates, but not on others: where it does not work, it throws an exception RPC_E_SERVERFAULT. What is it that could be the cause, and how can I fix it? (An exception occurs on the second line.)
wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
wordDoc = wordApp.Documents.Add(ref oTemplate, ref newTemplate, ref docType, ref isVisible);
wordApp.Visible = false;
wordDoc.Activate();
source
share