MSWord Addin "Operation Abort"

S

sikandarch

Below is the sample code for Word Add-in. Add-in is found and trying t
MSWord is trying to connect. This throws an exception on executin
"DtsAddin.Connect = true;" (Load on demand)

Program.cs
-----------

try
{
foreach (Microsoft.Office.Core.COMAddIn DtsAddin2 i
WordApp.COMAddIns)
{
DtsAddin = DtsAddin2;
if (DtsAddin.Description == "My Com Addin")
{
DtsAddin.Connect = true;
bFound = true;
break;
}
}
}
catch (Exception e)
{
string s = e.Message;
}

Connect.cs
-----------
[ComVisible(true)]
[ProgId("Cerner.MTMWordAddIn.Connect")]

[System.Runtime.InteropServices.Guid("FFA0920E-F7A5-453d-8AB2-249F4C25B4B2")]
[ClassInterface(ClassInterfaceType.None)]

public sealed class Connect : object, IDTExtensibility2
{
public void OnConnection(object Application, ext_ConnectMod
ConnectMode, object AddInInst, ref Array custom)
{
System.Windows.Forms.MessageBox.Show("OOnConnection");
//Expose the DTSApplication object through the word t
external application
Microsoft.Office.Core.COMAddIn oCOMAddinInst
(Microsoft.Office.Core.COMAddIn)AddInInst;
oCOMAddinInst.Object = wordAddIn.DTSApplication;// a
object;

}
}

public void OnDisconnection(ext_DisconnectMode RemoveMode, re
Array custom)
{
System.Windows.Forms.MessageBox.Show("OnDisconnection");
}
}

Any solution for this will be gr8.

OS:Vista
Office:2007
Note: I donot want to use VSTO as returning the extended object i
failing (returns null).

This *was* working fine. But suddenly on changing the interface(
think) "Operation Abort" exception is being thrown. (Tried unregisterin
and registering process)

I could even attach the code if required
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top