RequestComAddinAutomationService Netoffice

May 30, 2015 at 6:04 PM
Edited May 31, 2015 at 9:16 AM
In VSTO, it is possible to expose the addin object by overriding the RequestComAddinAutomationService method. As a consequence, the addin object can be accessed from outside, that is, it no longer null. For example, in vba as follows


How to achieve a similar behaviour with netoffice? RequestComAddinAutomationService is not available in netoffice

Any help is really appreciated,

Jun 4, 2015 at 6:37 AM
hello dominik,

thanks for pointing this out. i did not realize vsto spend a property like this and add to my to do list.

A quick hotfix in c# is to use the OnConnection event. something like this:

// create an instance of 'MyClass' and set to addin 'Object' property
void Addin_OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        object[] param = new object[1];
        param[0] = new MyClass();
        Application.GetType().InvokeMember("Object", System.Reflection.BindingFlags.SetProperty, null, AddInInst, param);

*hope this help
I want give a notification here when RequestComAddinAutomationService is available in NetOffice (next preview release).

Marked as answer by dodi000 on 6/4/2015 at 12:20 AM
Jun 4, 2015 at 7:20 AM
Hi Sebastian,

thank you very much, your solution works perfectly. The workaround I found in the meantime was also to use the onConnection event,
  if ((AddInInst as Microsoft.Office.Core.COMAddIn) != null)
                    Microsoft.Office.Core.COMAddIn comaddin = AddInInst as Microsoft.Office.Core.COMAddIn;
                    comaddin.Object = objectToBeUsed;
but the solution via reflection is much more elegant.