Visual Studio Development Bookmark and Share   
 index > Visual Studio Tools for Office > Disable Itens of Custom Ribbon
 

Disable Itens of Custom Ribbon

Hi there!

I used VSTO (Ribbon Visual Designer) to create my custom Ribbon (my custom Ribbon has about 30 buttons).

I set the TAG property of some buttons of my custom Ribbon with the value 'Enabled'.

Depending on some User Actions, I'd like to check the property TAG of each ribbon button and then, disable some ones depending on its contents.

I don't know how to check the TAG property of each 30 buttons and then disable some ones.

Many thanks for any kind of help.
Ciro
Oric.CQ  Wednesday, October 14, 2009 3:06 PM

Hello Ciro,

You could access this custom ribbon of office application. Then check Tag property of the buttons and set Enable property.  In my side, I have add a item named Ribbon1.cs as below, 

            ThisRibbonCollection ribbonCollection = Globals.Ribbons;
            OfficeRibbon ribbon=ribbonCollection.Ribbon1;
            if (ribbonCollection.Ribbon1.button1.Tag == "Enable")
            {
                ribbonCollection.Ribbon1.button3.Enabled = false;
            }


Here is a link about enabling button defined in a Ribbon Xml: Disable/Enable ribbon controls in Word 2007 Addin.
Useful links: Accessing the Ribbon at Run Time.

Best regards,
Bessie


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Marked As Answer byOric.CQ Friday, October 16, 2009 4:14 PM
  •  
Bessie Zhao  Friday, October 16, 2009 5:54 AM

Hello Ciro,

You could access this custom ribbon of office application. Then check Tag property of the buttons and set Enable property.  In my side, I have add a item named Ribbon1.cs as below, 

            ThisRibbonCollection ribbonCollection = Globals.Ribbons;
            OfficeRibbon ribbon=ribbonCollection.Ribbon1;
            if (ribbonCollection.Ribbon1.button1.Tag == "Enable")
            {
                ribbonCollection.Ribbon1.button3.Enabled = false;
            }


Here is a link about enabling button defined in a Ribbon Xml: Disable/Enable ribbon controls in Word 2007 Addin.
Useful links: Accessing the Ribbon at Run Time.

Best regards,
Bessie


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Marked As Answer byOric.CQ Friday, October 16, 2009 4:14 PM
  •  
Bessie Zhao  Friday, October 16, 2009 5:54 AM
Bessie,

Many thanks for your help!
Ciro
Oric.CQ  Friday, October 16, 2009 4:15 PM

You can use google to search for other answers

Custom Search

More Threads

• Outlook calendar change focus to a certain appointment item
• Developing add-in for Outlook 2000 - specific instructions?
• Copied Sheets don't have any Code... Solution?
• Outlook 2007 add-in, can it solve my problem?
• Blank mails
• Word 2007 AddIn Deploying Problem
• paneClassDC ????
• Problem with RibbonCommandButton Event handler
• Display Master-Detail information in Excel using groups
• VSTO 2005 beta2 with .NET 2003??