在程序中用C#操作WORD运行到这句时(
Word.Document wordDoc = wordApp.Documents.Add(ref ModelFileName, ref objNothing, ref objNothing, ref objNothing);
ModelFileName此为存放WORD的路径)就报错。报错信息如下:无法将类型为“Word.ApplicationClass”的 COM 对象强制转换为接口类型“Word._Application”。此操作失败的原因是对 IID 为“{00020970-0000-0000-C000-000000000046}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: RPC 服务器不可用。 (异常来自 HRESULT:0x800706BA)。 忘高手指教!谢谢
Word.Document wordDoc = wordApp.Documents.Add(ref ModelFileName, ref objNothing, ref objNothing, ref objNothing);
ModelFileName此为存放WORD的路径)就报错。报错信息如下:无法将类型为“Word.ApplicationClass”的 COM 对象强制转换为接口类型“Word._Application”。此操作失败的原因是对 IID 为“{00020970-0000-0000-C000-000000000046}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: RPC 服务器不可用。 (异常来自 HRESULT:0x800706BA)。 忘高手指教!谢谢
<system.web>
<identity impersonate="true" userName="你的用户名" password="你的密码"/>
</system.web>
<system.web>
<identity impersonate="true" userName="你的用户名" password="你的密码"/>
</system.web>
http://blog.csdn.net/lxy_abcde1190/archive/2008/06/26/2589160.aspx
http://kongjian.baidu.com/hclred/blog/item/dacba61c420a538887d6b64b.html/cmtid/800c66f034ab87a6a40f52b6
object oMissing = System.Reflection.Missing.Value;
Word._Application oWord;
Word.Document oDoc;
oWord = new Word.ApplicationClass();
//oWord.Visible = true;
object fileName = @"E:\\模板.doc"; oDoc = oWord.Documents.Open(ref fileName,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
代码如上,运行到oWord.Documents.Open()方法时就报:
无法将类型为“Word.ApplicationClass”的 COM 对象强制转换为接口类型“Word._Application”。此操作失败的原因是对 IID 为“{00020970-0000-0000-C000-000000000046}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: RPC 服务器不可用。 (异常来自 HRESULT:0x800706BA)。 真的郁闷的无可救药啦 望高手赐教!
我用c#操控excel时遇到同样的问题