Hide ribbon

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,066
Office Version
  1. 2016
Platform
  1. Windows
I am using the following to hide the ribbon and tabs/scrollbars. Although it works fine. I am still having some issues with it, if the workbook is minimised or reduce in size then the top half of the code fails and the ribbion and formula bar are no longer hidden

VBA Code:
Private Sub Workbook_Open()
        Application.DisplayFullScreen = True
        Application.CommandBars("Full Screen").Visible = False
        Application.CommandBars("Worksheet Menu Bar").Enabled = False

        ActiveWindow.DisplayGridlines = False
        ActiveWindow.DisplayHeadings = False
       Application.DisplayFormulaBar = False
       Application.DisplayTabBar = False
       ActiveWindow.DisplayWorkbookTabs = False
       ActiveWindow.DisplayHorizontalScrollBar = False
       ActiveWindow.DisplayVerticalScrollBar = False
Worksheets("Sheet1").Activate
 End With

End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Jaafar

Your code seems to work on its own, but not with my code added. I am trying to hide everything. This includes the
  • Sheet Tabs
  • Formula Bar
  • Both Scroll Bars
  • Status Bar at the Bottom

Before - on work book open
1619093814170.png


After - When minimised or workbook reduced in size
1619093747198.png


Current Code
VBA Code:
Private Sub Workbook_Open()
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",FALSE)"
    Application.DisplayFullScreen = True
    Application.CommandBars("Full Screen").Visible = False
    Application.CommandBars("Worksheet Menu Bar").Enabled = False
    ActiveWindow.DisplayGridlines = False
    ActiveWindow.DisplayHeadings = False
    Application.DisplayFormulaBar = False
    ActiveWindow.DisplayWorkbookTabs = False
    ActiveWindow.DisplayHorizontalScrollBar = False
    ActiveWindow.DisplayVerticalScrollBar = False 

Worksheets("Sheet1").Activate
End Sub

Also will this work on All excels
VBA Code:
  Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",FALSE)"

Thanks
 
Upvote 0
Also will this work on All excels
Do you mean you want to hide everything on ALL currently open excel windows at the same time or you want to hide things ONLY on the current workbook window ?
 
Upvote 0
Sorry Jaafar when I asked about "Will this work with all excels" I was refering to the different excel versions like 2007, 2010, and so on.

As for hiding everything, it is only for the workbook that the code is in. See attached demo for what I am trying to achive

Download Demo File

Also is it possible to hide the cell selections,
1619166747616.png


Hope this helps. Thanks
 
Upvote 0
Place this in the ThisWorkbook Module and see if OK :
VBA Code:
Option Explicit

Private Sub Workbook_Activate()
    Call FullView(True)
End Sub

Private Sub Workbook_Deactivate()
    Call FullView(False)
End Sub

Private Sub Workbook_WindowResize(ByVal Wn As Window)
    With Application
        .ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",FALSE)"
        .DisplayFormulaBar = False
    End With
End Sub

Private Sub FullView(ByVal bFullView As Boolean)
    With Application
        .ExecuteExcel4Macro ("SHOW.TOOLBAR(""Ribbon""," & CBool(Not bFullView) & ")")
        .DisplayFullScreen = bFullView
        .CommandBars("Full Screen").Visible = Not bFullView
        .CommandBars("Worksheet Menu Bar").Enabled = Not bFullView
        .DisplayFormulaBar = Not bFullView
        .ActiveWindow.DisplayGridlines = Not bFullView
        .ActiveWindow.DisplayHeadings = Not bFullView
        .ActiveWindow.DisplayWorkbookTabs = Not bFullView
        .ActiveWindow.DisplayHorizontalScrollBar = Not bFullView
        .ActiveWindow.DisplayVerticalScrollBar = Not bFullView
    End With
End Sub
 
Upvote 0
Solution
Jaafar this is super,

Only one issue the bottom status bar reapears after workbook is minimised, any chance this can also stay hidden.

1619175224711.png
 
Upvote 0
It ok I have done it, Just added this

VBA Code:
Private Sub Workbook_WindowResize(ByVal Wn As Window)
    With Application
        .ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",FALSE)"
        .DisplayFormulaBar = False
        .DisplayStatusBar = False ''' Added This
    End With
End Sub
 
Upvote 0
i tried these codes, very good but how you bring back everything, i mean back to normal sheet with all tabs
 
Upvote 0

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top