Vb.net无法将COM对象转换为Class类型

时间:2018-10-01 19:07:10

标签: vb.net com

我在excel.ComAddin.Item(“ r12.abc”)。object上遇到问题,该问题返回对象,其类型为Cognos.office.Connect,然后在Connect类上调用函数返回WrapperObject。我需要从Wrapperobject中获取方法以进行进一步调用。

Dim obj As Microsoft.Office.Core.COMAddIn = _excel.COMAddIns.Item("r12.abc")


 If (obj.Connect) AndAlso obj.Object IsNot Nothing Then

 o = CType(obj.Object, Cognos.Office.BootStrap.Connect) --  Error says COM obj cant be convert to class but if i doesnt convert as class i cant read o.Wrapperobject()
 o.Wrapperobject()

 End If

0 个答案:

没有答案