none
Disable menus/Buttons from MS Word if Word is opened from my application RRS feed

  • Question

  • Hi,

    I have one application from which word document is opened on some event.

    When MS Word is opened from my application, I want to disable New/Open etc. menus and 'Word Options'/'Exit Word' etc. buttons.

    Above should work as it is, if I open MS word directly, i.e. if I run 'winword'.

    Thanks

     

     

     

    Thursday, January 27, 2011 7:21 AM

Answers

  • Hi Ecpl2010

    Since your question is about automating Word from an outside process you aren't using VSTO. In that case, the better venue for your question is the Word Developer forum, so I'm going to move this discussion there.

    I assume you're targeting Office 2007 or 2010, since you mention "Word Options"/"Exit Word". In that case...

    No, there's absolutely no way for you to affect what commands are displayed from outside the Word application. The Ribbon design is expressly designed to not allow it. The command interface can only be modified in-process by placing a Ribbon in a document or a template, or by a Com Add-in.

    A possible way for you to achieve this would be to add a Ribbon XML to a template file. Have your application load this template file as an Add-in (Application.Addins collection - you'll find the methods and properties in the object model Help for that object.) As long as there's no other Add-in, loading at a later point, that overrides your changes and the user does not open a document containing Ribbon XML that overrides your changes, the interface will look as set by the Ribbon XML in your template add-in.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bessie Zhao Tuesday, February 1, 2011 8:31 AM
    Thursday, January 27, 2011 7:58 AM
    Moderator