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)

Published by

Dinesh Kumar Takyar

Welcome to exceltrainingvideos.com! My aim is to help you learn MS Excel including VBA. I always felt that a good way to learn something was to find solutions to problems in that domain. That is why I share these Excel videos with you. Mostly these are questions asked during my corporate training sessions. I've been training individuals and companies in computers since 1991. I did my B. Sc. (Vordiplom), M. Sc. (Diplom) and Ph.D. (Dr. rer. nat.) from Hamburg, Germany. The best thing about solving some of my visitor's questions is that I also gain new insights. For more Excel VBA solutions you may like to visit my YouTube channel: http://youtube.com/familycomputerclub For a structured Excel VBA training course online you can visit: https://www.youtube.com/excelvbaonline

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.