我正在使用vb.net创建word文档,我有以下代码:
Imports word = Microsoft.Office.Interop.Word
Imports xl = Microsoft.Office.Interop.Excel
Dim oWord As New word.Application
Dim oDoc As word.Document
oWord.Visible = global_variables.ShowWordDocs但是在运行时,我在最后一行得到了这个错误:
Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-
0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).最后一行的值等于False
我曾尝试修复Microsoft Office -我安装的全部是word、excel、office共享功能和office工具- 2010版
发布于 2015-08-13 23:47:05
错误意味着COM接口有问题。您是否尝试过重新注册(RegSvr32.exe /i ...)Word/Excel的COM DLL/TLB/OLB?这些文件将位于Office安装文件夹中(例如C:\Program Files\Microsoft Office\Office14)
https://stackoverflow.com/questions/31992465
复制相似问题