VBA & Macro Problems

Show, Hide, or Minimize the Excel Ribbon with VBA

John WilsonJohn Wilson Nov 18, 2026 871 views

Question details

Control whether the Excel Ribbon is displayed, hidden, or minimized using VBA.

Show, Hide, or Minimize the Excel Ribbon with 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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In Excel, open Developer > Visual Basic, then choose Insert > Module.

2
Add show and hide macros

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

3
Add the minimize toggle

In the same module, paste: Sub ToggleRibbonMinimized() Application.CommandBars.ExecuteMso "MinimizeRibbon" End Sub

4
Run the macro you need

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 VBA to show, hide, or toggle the Excel Ribbon
The minimize command is a toggle: MinimizeRibbon switches the current state: an expanded Ribbon becomes tabs-only, and a minimized Ribbon expands. Showing a hidden Ribbon does not guarantee that it will be expanded. The SHOW.TOOLBAR command is Excel-specific and may be restricted by security policy.
Free Microsoft Office alternative

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.

A familiar Ribbon-style interface for spreadsheet workCompatible with Microsoft Excel formats such as XLSX and XLSFree tools for everyday document and spreadsheet editingLightweight installation for a straightforward move from Office
microsoft office alternative - wps office

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.