none
When opening a .doc file with RibbonX in the getLabel callback the IRibbonControl.Context is null (Word 2007 SP2, VSTO 4) RRS feed

  • Question

  • Hi,

    I created a new Word Add-In with a Ribbon. Just added the getLabel with the corresponding callback.

     

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">
     <ribbon>
     <tabs>
     <tab idMso="TabHome">
     <group id="MyGroup"
     getLabel="getLabel">
     </group>
     </tab>
     </tabs>
     </ribbon>
    </customUI>
    

     

    If I start Word with a new document the callback gets called with the IRibbonControl.Context set to the current window as it should be.

    If I open a Document via double-click, the callback gets called with IRibbonControl.Context as null.

    It seems like the callback is called before the window is initialized. The application.ActiveWindow is also null.

    Did I make a mistake?

    Are there any workarounds how to get the window, e.g. delaying the callbacks for the ribbon etc.

     

     


    Viele Grüße Mark





    Tuesday, June 7, 2011 10:35 AM

Answers

  • Hello,

    You can try using the WindowActivate event of the Word.Application object.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    • Marked as answer by Wompi Thursday, June 9, 2011 12:58 PM
    Wednesday, June 8, 2011 12:23 PM

All replies

  • Hello,

    You can try using the WindowActivate event of the Word.Application object.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    • Marked as answer by Wompi Thursday, June 9, 2011 12:58 PM
    Wednesday, June 8, 2011 12:23 PM
  • Hi,

    that worked.

    Thanks a lot :)


    Viele Grüße Mark
    Thursday, June 9, 2011 12:58 PM