VB.Net和Microsoft.Office.Interop.Word/Excel [英] VB.Net and Microsoft.Office.Interop.Word/Excel
问题描述
我制作了一个VB应用程序,其中使用了Microsoft.Office.Interop(Excel,Outlook和Word)
I have made an VB-applicataion in which I use Microsoft.Office.Interop (Excel, Outlook and Word)
在其他计算机(Windows10 + Ofiice 365)上没有问题.最近,我在计算机上进行了Windows10的全新安装.我重新安装了Ofiice365.我的应用程序不再起作用.
On different computers (Windows10 + Ofiice 365) no problem. Recently I made a clean installation of Windows10 on a computer. I re-installed Ofiice 365. My application does not work anymore.
一些代码行:
WD_App =新的Microsoft.Office.Interop.Word.Application
WD_App = New Microsoft.Office.Interop.Word.Application
试试
Try
WD_App.Visible = True
异常捕获
结束尝试
WD_App.Visible = True
Catch ex As Exception
End Try
我在使用Word和Excel时得到了ex.message(荷兰语)的信息(Outlook没问题)
I get as ex.message (dutch) in applying Word and Excel (Outlook no problem)
可将COM对象的Microsoft.Office.Interop.Word.ApplicationClass类型转换为Microsoft.Office.Interop.Word._Application的接口类型. Deze bewerking是QueryInterface-aanroep或or COM-onderdeel的接口不正确的接口 碰到IID {00020970-0000-0000-C000-000000000046}是错误的fout:fout bij载货卡车类型为DLL-stand. (Uitzondering van HRESULT:0x80029C4A(TYPE_E_CANTLOADLIBRARY).)
Kan COM-object van het type Microsoft.Office.Interop.Word.ApplicationClass niet converteren naar interfacetype Microsoft.Office.Interop.Word._Application. Deze bewerking is mislukt doordat de QueryInterface-aanroep voor het COM-onderdeel voor de interface met IID {00020970-0000-0000-C000-000000000046} is mislukt door de volgende fout: Fout bij laden van type DLL-bestand. (Uitzondering van HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
出什么问题了
谢谢
威廉
推荐答案
第一个问题是您没有使用翻译器将错误转换为英语论坛的英语.
Well the first problem is you didn't use a translator to convert the error to english for an english forum.
" COM对象 可以 不能 转换 it 到 Microsoft.Office.Interop.Word.ApplicationClass 类型 接口 类型 Microsoft.Office.Interop.Word._Application . 此 操作失败 ,因为 QueryInterface 通话 on COM组件 与 的接口 IID { 00020970-0000-0000 - C000-000000000046 }失败 具有以下 错误: 错误加载 类型库 文件. ( 中的异常 HRESULT: 0x80029C4A ( TYPE_E_CANTLOADLIBRARY ) )"
"COM object can not convert it to Microsoft.Office.Interop.Word.ApplicationClass type 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 with the following error: Error loading type library file. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))"
显然,某些库文件无法加载.我的猜测是Microsoft.Office.Interop库.Dll文件.
Apparently some library file can not be loaded. My guess would be the Microsoft.Office.Interop libraries .Dll file.
我不知道Windows 10的全新安装可能会如何影响.我不知道为什么重新安装Office 365可能会受到影响.
How a clean installation of Windows 10 may have affected that I do not know. Why a re-install of Office 365 may have affected that I do not know.
如果Windows 10的全新安装意味着系统磁盘已格式化,因此没有任何内容,然后安装Windows 10并运行系统,然后又安装了Office 365,而不是重新安装,则某些.Dll不是可能可用 无论出于何种原因.
If clean installation of Windows 10 means that the systems disk was formatted so nothing was on it and then Windows 10 was installed and the system ran and then Office 365 was installed rather than being re-installed then some .Dll isn't available maybe for whatever reason that would be.
但是,您还应该显示ex.StackTrace,它可能会提供更多信息来解决问题.
You should however also display ex.StackTrace which may provide greater information for resolving the issue.
Try
WD_App.Visible = True
Catch ex As Exception
MessageBox.Show(ex.Message & vbCrLf & vbCrLf & ex.StackTrace)
End Try
这篇关于VB.Net和Microsoft.Office.Interop.Word/Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!