Persistent menu in Word (through VSTO 2005)

Is it possible to create a persistent menu in MS Word 2003 via any other means than implementing IDTExtensibility2 interface

All other parts of our project are implemented using VSTO 2005, but we also need a 'starting point' of sorts - i.e. a menu or a smart panel that is always present (no matter what type of document or even if no document is open).

Any suggestions are welcome.


Thank you,

-Nick


Answer this question

Persistent menu in Word (through VSTO 2005)

  • Steven Randolph

    You can create a Word VSTO template solutions and put it into Word startup folder (in Word: Tools->Templates and Addins)

    Regards,
    Peter

  • Christatos

  • damuser

    Peter,

    Thank you for your reply.

    Could you please provide me with more details (or point me to a place which may have further info) on how exactly I would go about adding such a menu
    I cannot seem to find an example on MSDN or elsewhere...

    Thank you,

    -Nick

    P.S.: I tried inserting this into the startup method of the ThisDocument.cs, but it throws an Exception. In this case, I'm trying to add a sub-menu to a context menu, but I assume it wouldn't be any different for other top-level menus.


    Office.CommandBarPopup popupMenu = (Office.CommandBarPopup) this.ThisApplication.CommandBars["Text"].Controls.Add(Office.MsoControlType.msoControlPopup, this.missing, this.missing, this.missing, true);

    popupMenu.Caption = "Sample menu";

    popupMenu.Tag = "Sample";


     





    EDIT: I found why the above didn't work. Apparently, I need to do the above steps from within another class with a [ComVisible(true)] tacked on top.

    See post "Calling managed code with Beta 2" on microsoft.public.vsnet.vstools.office for more info.

    Now, to figure out how to catch the click event...


  • Yogesh Ranade

    Hi Nick,

    Word documents/templates customized with VSTO cannot be used as global templates (or loaded from the Startup directory of Word). For more information, see "Limitations of Global Templates and Add-ins" at http://msdn2.microsoft.com/en-us/library/ms178759(en-US,VS.80).aspx.

    Kathleen
    http://blogs.msdn.com/vsto2/

  • David Teitlebaum MSFT

     PeterJausovec wrote:
    You can create a Word VSTO template solutions and put it into Word startup folder (in Word: Tools->Templates and Addins)

    Regards,
    Peter


    Peter,

    Can you elaborate on this please Do I just place the .DOT and .DLL files in some folder and point to it through Templates and Addins Or is there more to it

    I tried doing the above, and Word produced an error, saying that "The document template is not valid."  Is there a step that I am missing

    Thanks,

    -Nick

  • Persistent menu in Word (through VSTO 2005)