C++/CLI com-Interop: Exposing a reference type property to VBA
Posted
by
Adam
on Stack Overflow
See other posts from Stack Overflow
or by Adam
Published on 2012-10-25T10:57:27Z
Indexed on
2012/10/25
11:00 UTC
Read the original article
Hit count: 302
After long hours of investigation on exposing C# property that accepts a reference type to VBA, I concluded that it was not possible. In brief, a C# property that is of type double[] or even an object cannot be consumed in VBA like this:
' Compile Error: Function or interface marked as restricted,
' or the function uses an Automation type not supported in Visual Basic
oComExposedEarlyBinding.ObjectArray = VBArray
' Run-time error 424: Object required
oComExposedEarlyBinding.PlainObject = VBArray
Or for more details: C# property exposed to VBA (COM) : Run-time error '424': Object required
I would like to know if C++/CLI would support such an option? i.e. Allowing a reference-type property to be exposed to VBA so that a syntax like the above is valid.
N.B. You can achieve this by using late binding, but losing the intellisense is not an option.
© Stack Overflow or respective owner