Hide Show Ribbon in Excel Using VBA

How to hide and show ribbon in Excel using VBA. We can also hide the formula bar to prevent users from viewing our formulas. The status bar and the worksheet tabs can also be hidden automatically using VBA. This creates a dramatic effect and the user sees only the file name at the top of the workbook and the cells in which she can enter data. Watch the video VBA tutorial below:

How to hide and show the Ribbon in Excel automatically

Here’s the complete VBA code to hide and show the different parts of an Excel workbook to achieve different goals:

Sub hide_ribbon()

‘hide formula bar
Application.DisplayFormulaBar = False

‘hide status bar
Application.DisplayStatusBar = False

‘hide worksheet tabs
ActiveWindow.DisplayWorkbookTabs = False

‘hide Ribbon
Application.ExecuteExcel4Macro “show.toolbar(“”Ribbon””,False)”


End Sub

Sub show_ribbon()

‘show formula bar
Application.DisplayFormulaBar = True

‘show status bar
Application.DisplayStatusBar = True

‘show worksheet tabs
ActiveWindow.DisplayWorkbookTabs = True

‘show ribbon
Application.ExecuteExcel4Macro “show.toolbar(“”Ribbon””,True)”

End Sub

We can hide the different controls of the workbook when the workbook opens by placing the code above in the workbook open event as shown below:

Private Sub Workbook_Open()
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
ActiveWindow.DisplayWorkbookTabs = False
Application.ExecuteExcel4Macro “show.toolbar(“”Ribbon””,False)”
ActiveWindow.DisplayWorkbookTabs = False
End Sub

Hid/Show Ribbon

Further Reading:

Display and Hide Tabs, Groups, and Controls on the Microsoft Office Ribbon User Interface (Part 1 of 2)