Click here to Skip to main content
15,878,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am facing issues like Type Mismatch while passing Array of interfaces from .NET to VBA and vice versa using VSTO technology.

My requirement is that ComInterfaceType needs to be InterfaceIsIDispatch.

My Interface definition is somewhat like this

C#
[ComVisible(true)]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    [Guid("AAF48FBC-52B6-4179-A8D2-944D7FBF264E")]
    public interface IInterface1
    {

        [DispId(0)]
        IInterface2[] GetObj();

        [DispId(1)]
        void SetObj(ref IInterface2[] obj);
    }

    [ComVisible(true)]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    [Guid("CDC06E1D-FE8C-477E-97F1-604B73EF868F")]
    public interface IInterface2
    {     
    }


IF i am passing array of above interface (created in C#.Net) to VBA using GetObj API of IInterface1 from VBA,i am getting type mismatch error in VBA while assigning the value to variable in VBA.Even assigning to variant type variable gives TypeMismatch.


Kindly provide some assistance regarding the same.


Thanks.
Posted
Updated 2-Mar-15 23:45pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900