none
Hide button from ribbon via VBA RRS feed

  • Question

  • Hi,

    I am using MS Word 2010. I have created a ribbon and everything works fine. My add-in is given to a number of users.

    I would like to hide or show 2 buttons from my ribbon depending on who is using it. My question is "How can I hide or show buttons on Office ribbon via VBA"

    I worked out hidding different tabs, but it's not what I want.

    Any help is much appreciated.

    Thanks.

    Thursday, March 3, 2011 10:26 AM

Answers

  • Hi Pranav

    Is your Add-in a VSTO Add-in? A Shared Add-in? A Word template Add-in?

    The Ribbon is explicitly designed to not expose custom components (non-built-in controls) to any other process. So VBA cannot directly make something visible or not visible. That has to be controlled via your add-in, which means we have to better understand what type of add-in you have designed :-)


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Pranav Vaidya Monday, August 6, 2012 10:04 AM
    Thursday, April 7, 2011 1:24 PM
    Moderator

All replies

  • Hello,

     

    In C# all the components in the ribbon have the "Visible" attribute. Simply set it to False, and the ribbon component will disappear.

    If you want to do this when the user launches Word, put you cone in the Ribbon constructor, after the Initialization();

     

    Best regards,

    Silviu.


    http://www.rosoftlab.net/
    Thursday, April 7, 2011 1:09 PM
  • Hi Pranav

    Is your Add-in a VSTO Add-in? A Shared Add-in? A Word template Add-in?

    The Ribbon is explicitly designed to not expose custom components (non-built-in controls) to any other process. So VBA cannot directly make something visible or not visible. That has to be controlled via your add-in, which means we have to better understand what type of add-in you have designed :-)


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Pranav Vaidya Monday, August 6, 2012 10:04 AM
    Thursday, April 7, 2011 1:24 PM
    Moderator