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
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