Discussion:
VBA & .NET Com Interop(Events give Type-Mismatch Error) -v Interes
(too old to reply)
shrey
2009-07-02 17:32:13 UTC
Permalink
Hi,

I have a very interesting problem

Basically i have made a COM Dll in VB.Net (.Net 2.0) so that it can
interact with my existing Excel VBA Code.
I have used ComSourceInterfaces to basically source a single Event back to
my VBA Code.

Note that the delegate has 3 parameters in total of which 1 is a Arrray of
custom type declared in my DLL and One is a simple String and One is a
System.Exception type.

The problem is if i declare the class as withevents and then raiseevent
it gives an error saying type mismatch..

It does not even raise that event and fails on the line RaiseEvent inside
the .Net Dll

My Analysis
I think the problem is that Excel VBA , when is is sourcing events is not
able to "see" the custom parameters..

Any one have a work around for this?

Regds
Shrey
shrey
2009-07-03 07:55:01 UTC
Permalink
Ok I can confirm that the events work if they are simple type...or even a
custom type

they do NOT work if it has of type sytem.exception , or if it an array
Post by shrey
Hi,
I have a very interesting problem
Basically i have made a COM Dll in VB.Net (.Net 2.0) so that it can
interact with my existing Excel VBA Code.
I have used ComSourceInterfaces to basically source a single Event back to
my VBA Code.
Note that the delegate has 3 parameters in total of which 1 is a Arrray of
custom type declared in my DLL and One is a simple String and One is a
System.Exception type.
The problem is if i declare the class as withevents and then raiseevent
it gives an error saying type mismatch..
It does not even raise that event and fails on the line RaiseEvent inside
the .Net Dll
My Analysis
I think the problem is that Excel VBA , when is is sourcing events is not
able to "see" the custom parameters..
Any one have a work around for this?
Regds
Shrey
Loading...