C++/CLI com-Interop: Exposing a reference type property to VBA
- by Adam
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.