后期绑定excel事件中的问题

时间:2016-10-06 14:32:45

标签: c# vb.net .net-framework-version

我希望在没有Excel dll的情况下在后期绑定中获取Excel事件。我可以在" AnyCpu"中的目标cpu中获取我的代码事件。和" x64"但我无法在目标cpu" x86"中得到相同的结果。我需要在" x86"。

中运行我的应用程序

我已按如下方式创建了Excel对象:

Dim ExcelType As Object = Type.GetTypeFromProgID("Excel.Application")

Dim exlApp As Object= Activator.CreateInstance(ExcelType)

Dim evSheetActivate As EventInfo = ComType.GetEvent("SheetActivate")

如果我的TargetCpu是" AnyCpu"或" x64",对象ExcelType显示" Microsoft.Office.Interop.Excel.ApplicationClass"。

如果我的TargetCpu是" x86",ExcelType显示" System .__ ComObject"。

如果它出现在" System .__ ComObject"我无法得到我的活动。

我是否能够投射" System .__ ComObject"进入" Microsoft.Office.Interop.Excel.ApplicationClass",还是有其他解决方案来解决这个问题?

0 个答案:

没有答案
相关问题