Show, Hide, or Minimize the Excel Ribbon with VBA
Question details
Control whether the Excel Ribbon is displayed, hidden, or minimized using VBA.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants to change the Ribbon display programmatically from an Excel macro.
- Observed behavior
- The desired result is to show the full Ribbon, display only its tabs, or hide it completely.
Open the workbook in a desktop version of Excel that supports VBA and confirm that macros are permitted by your security settings. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) if you want to keep the code in it.
Use VBA to show, hide, or toggle the Excel Ribbon
Use Excel's macro commands to hide or show the Ribbon and switch between expanded and minimized views.
Excel does not expose Ribbon visibility as a normal VBA property. The SHOW.TOOLBAR command controls whether the Ribbon is visible, while MinimizeRibbon toggles its expanded or minimized state.
In Excel, open Developer > Visual Basic, then choose Insert > Module.
Paste these procedures into the module: Sub HideRibbon() Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",FALSE)" End Sub Sub ShowRibbon() Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",TRUE)" End Sub
In the same module, paste: Sub ToggleRibbonMinimized() Application.CommandBars.ExecuteMso "MinimizeRibbon" End Sub
In the VBA editor, place the cursor inside HideRibbon, ShowRibbon, or ToggleRibbonMinimized and select Run > Run Sub/UserForm. Run ShowRibbon to restore a hidden Ribbon.

Use Ribbon XML for custom Ribbon controls
Use Ribbon XML when you need to customize tabs, groups, or controls rather than simply change Ribbon visibility.
Work with spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format compatibility for easier migration. Use WPS Spreadsheets to open and edit Excel files; the Excel-specific Ribbon VBA commands in this article are not a WPS fix.

Frequently Asked Questions
How do I restore the Ribbon after hiding it with VBA?
Run a VBA procedure containing Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",TRUE)" from the VBA editor. If the Ribbon returns minimized, use the MinimizeRibbon toggle to expand it.
Can VBA display only the Ribbon tabs?
Use Application.CommandBars.ExecuteMso "MinimizeRibbon" when the Ribbon is expanded. This command toggles the state, so running it again expands the Ribbon.
Does showing the Ribbon automatically expand it?
Not necessarily. SHOW.TOOLBAR makes the Ribbon visible, but its minimized or expanded state may remain unchanged. Use the MinimizeRibbon toggle if the visible state is not what you want.
Will these commands work in Word or PowerPoint?
The SHOW.TOOLBAR example uses Excel's ExecuteExcel4Macro method and is specific to Excel. Do not assume it will work in other Office applications.
Do I need Ribbon XML just to hide the Excel Ribbon?
No. Use Excel's SHOW.TOOLBAR command in VBA to hide or show it. Ribbon XML is useful when you need to customize tabs, groups, or controls.




