Hide tabs and ribbon in Excel with VBA

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,585
Office Version
2016
Platform
Windows
Hi
I wonder how to autohide the ribbon and tabs with VBA

Bengt
One way :
Code:
Sub ShowRibbon(ByVal Show As Boolean)
  Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon""," & Show & ")"
End Sub
Then to hide it :
Code:
Sub Test()
    Call ShowRibbon([COLOR=#0000ff]False[/COLOR])
End Sub
To show it:
Code:
Sub Test()
    Call ShowRibbon([COLOR=#0000ff]True[/COLOR])
End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
35,643
Office Version
365
Platform
Windows
Cross posted https://www.excelforum.com/excel-pr...ohide-ribbon-and-tabs-in-excel-using-vba.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,585
Office Version
2016
Platform
Windows
If you mean Auto-Hiding then

Code:
Sub AutoHideRibbon()
    Application.CommandBars.ExecuteMso "HideRibbon"
End Sub
 

Forum statistics

Threads
1,089,559
Messages
5,408,971
Members
403,246
Latest member
NateD1

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top