PDA

View Full Version : Hiding ribbon commands



nikki333
04-25-2018, 12:21 PM
Hi Folks

Trying to hide the commands from tabs. So far I've found a way to hide:

Application.ExecuteExcel4Macro "Show.Toolbar(""Ribbon"",false)"

However, that hides the all of it. I'd like to have only the tab names (ie. Start, Insert, PageLayout,...) as if choosing the option in the picture below.

22101

SamT
04-25-2018, 01:52 PM
seee: http://www.vbaexpress.com/forum/showthread.php?62570-TabHelp-Can-it-be-hidden

nikki333
04-26-2018, 03:01 AM
This seems to do the trick:

CommandBars.ExecuteMso "MinimizeRibbon"

nikki333
04-26-2018, 12:18 PM
...However it's a trigger Statement, ie. alternating minimizing and maximizing the ribbon. Therefore I introduced 2 variables to track the current state via the ribbon height:

numHöheMenübandAus = CommandBars("Ribbon").Height


CommandBars.ExecuteMso "MinimizeRibbon"


numHöheMenübandEin = CommandBars("Ribbon").Height


If Not numHöheMenübandAus < numHöheMenübandEin Then
CommandBars.ExecuteMso "MinimizeRibbon"
End If

This works fine when walking through in debug mode, however, when calling the procedure at once via picutures with assigned macros, it does hide the ribbon, but not unhide it.

If anyone likes to have a look into my file, the pw = plan; and if so, any comments or tips to improve are very welcome :)


cheers and regards :)