簡體   English   中英

vb.net word應用程序互操作對象錯誤

[英]vb.net word application interop object error

我正在使用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版

錯誤表明COM接口存在問題。 您是否嘗試過重新注冊(RegSvr32.exe / i ...)Word / Excel的COM DLL / TLB / OLB? 這些將位於您的Office安裝文件夾中(例如C:\\ Program Files \\ Microsoft Office \\ Office14)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM