none
How to access Application level com addon from document level addon ? RRS feed

  • Question

  • Hi All,

    I've been working on VSTO addons for Word (2010 dev / 2007 end user) and my situation is as follows :

    I've got two addons, one application level addon which has custom ribbon filled with controls that modify active document (toggles paragraphs via bookmars etc.) and one which is the document application that has the word document (document has some functionality as well.)

    Now i'd like to access the Application level add in (or just the custom ribbon that it holds) from the document application to change the ribbons visibility, so that the ribbon would only be shown when the word document in question would be active. I pressume the application level addon's Ribbon element should be accessed through the Globals.Ribbons collection some how, but i just can't figure out how.

    The reason why i the ribbon is in application level add in is that there will be more document level addins using the same ribbon in the future. If this is the wrong way to go, could you please point me in the right direction.

    All help / comments are much appriciated.

    Wednesday, February 22, 2012 1:54 PM

Answers

  • Hello,

    Any public property/method provided by a COM add-in is accessible via WordApp.COMAddins.Item(strComAddinProgId).PublicPropertyOrMethod. Note that to call PublicPropertyOrMethod you use late binding, see System.Type.InvokeMember in MSDN.


    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.

    • Marked as answer by Oksa Thursday, February 23, 2012 8:02 AM
    Wednesday, February 22, 2012 2:14 PM

All replies

  • Hello,

    Any public property/method provided by a COM add-in is accessible via WordApp.COMAddins.Item(strComAddinProgId).PublicPropertyOrMethod. Note that to call PublicPropertyOrMethod you use late binding, see System.Type.InvokeMember in MSDN.


    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.

    • Marked as answer by Oksa Thursday, February 23, 2012 8:02 AM
    Wednesday, February 22, 2012 2:14 PM
  • Thanks!

    I found that this article contained everything i needed after you nudged me in the right direction.

    Thursday, February 23, 2012 8:05 AM