Saturday, August 04, 2012 2:35 PM
I have looked around but couldn't find how to do this.
Basically I want to create a button on a worksheet which minimize or unminimize the ribbon.
I was thinking it should be something like
this.application.minimizeRibbon = false;
this.application.minimizeRibbon = true;
I have tried
Strangely, it turn on/off 'Num Lock' on the keyboard.
Anyone can help me out please?
Sunday, August 05, 2012 4:49 AM
Do you mean so that you cannot see the ribbon. (In Excel it is under View ribbon -> Full Screen to hide the ribbon and display Full Screen. Esc returns to normal view with ribbon.)
In VBA it is the following so maybe it will give you the hint for C# 2010 (Vsto)
Application.DisplayFullScreen = True
Application.DisplayFullScreen = False
Thursday, August 09, 2012 9:17 AM
Hi Thanks for the reply.
I am talking about minimization of ribbon by right click on the ribbon and tick 'minimize the ribbon'
But I think full screen display can be useful to my situation.
I am going to look into it.
Thursday, August 09, 2012 11:54 AM
You can use SendKeys to toggle Minimize/Maximize the ribbon.
Private Sub CommandButton1_Click()
If Application.CommandBars.Item("Ribbon").Height > 81 Then
CommandButton1.Caption = "Maximize Ribbon"
CommandButton1.Caption = "Minimize Ribbon"
Use the following to determine the height of the ribbon when Maximized and also when Minimized and you can use those values in the code above to determine the state (and set the button Caption as I have done) before using the SendKeys to toggle.
However, note that you cannot test it by running from the VBA Editor window because it will open Help. You need a button on the worksheet to test. If using an AxtiveX CommandButton then need to set the Property "TakeFocusOnClick" to False or the SendKeys does not work.
Friday, August 10, 2012 6:31 AM
But in C#, I doesn't work.
'Item' Property is not there.
Can you tell me a equivalent code in c#?
Monday, August 27, 2012 8:22 AMModerator
You've mentioned that sendkeys will turn off your numlock key. This scenario is an known issue and you can see it on this KB page.
Hope it helps.
Quist Zhang [MSFT]
MSDN Community Support | Feedback to us