我创建了一个应用程序(在visual studio 2015和.net中),可以写入Word 2013(它创建Word文档,通过书签填写文本、表格、数字等段落),它一直运行良好,但现在我的公司将office升级到365版本,我在与365版本的Word通信时遇到了错误。
我已经为我的项目添加了所有正确的参考:
微软。办公室。互操作。Word
微软。Office.core
Microsoft Office 16.0对象库
但我收到以下错误:
COMException was unhandled
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
我的代码很简单,错误发生在
将appWord设为新单词。应用程序
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop
Private Sub word_Click(sender As Object, e As EventArgs) Handles word.Click
**Dim appWord As New Word.Application**
Dim docWord As New Word.Document
docWord = appWord.Documents.Add("s:\direct\ph1English.docx")
appWord.Visible = True
End Sub
我不确定新版Office有什么变化,我购买扩展程序或任何使其工作的东西都没有问题,我只是不知道需要什么让我的应用程序再次与word通信,
我真的很感激你能提供的任何帮助
非常感谢。
弗莱德
我已尝试添加所有需要的引用