The following is some source that I have that I need some help with:

Word.Document doc = app.Documents.Add(ref template, ref optional, ref
optional, ref Visible);
// Connect the addin
object addIn = "ACTWordAddInTest.Connect";
Microsoft.Office.Core.COMAddIn comAddIn = app.COMAddIns.Item(ref addIn);
comAddIn.Connect = true;
ACTWordAddInTest.IWordTest test = comAddIn.Object as
ACTWordAddInTest.IWordTest;
if (test != null )
{
 MessageBox.Show(test.Name());
}

When running this the comAddIn.Object value is null even though the addin
was connected.  How can I cast the comAddIn object to the .Net
ACTWordAddInTest.IWordTest interface so that I can pass it values or get
values from the add-in in my .Net project.  Is this a bug with interop
that is not setting the COMAddIn.Object value?

Any help would be great.

Thanks in advance.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to