Referencing a com addin from a .net application via ole automa
Hi
"DM Unseen" wrote:
you have a .NET c# app that launces/connects to Excel through (OLE)
Automation, and now want to launch a comm addin as well through the
..NET app?
No, my addin is loaded when excel starts. What I'm trying to do is to cast a
COMAddIn object retrieved from Excel.Application.COMAddIns collection to my
add-in type for further use.
As an example, here's the code from my .net app:
object myComAddIn = comAddIn.GetType().InvokeMember("Object",
BindingFlags.Public | BindingFlags.GetProperty,
null, comAddIn, null);
myComAddIn.GetType().InvokeMember("Test",
BindingFlags.Public | BindingFlags.InvokeMethod,
null, myComAddIn, null);
The above code successfully invokes the Test() method of my COM AddIn. What
I'm trying to do next is to cast myComAddIn to my com add-in type, which
fails.
The reason is to be able to subscribe to add-in's custom events. Any ideas?
Luke
|