Office Settings & Configuration

Show the Microsoft Excel Ribbon and Restore the Toolbar with VBA

Camila MilosovichCamila Milosovich Nov 12, 2026 870 views

Question details

Show the Microsoft Excel Ribbon again and restore access to the worksheet toolbar area by using VBA.

Show the Microsoft Excel Ribbon and Restore the Toolbar with VBA
Product
Microsoft Excel VBA
Device & OS
not provided
Scenario
The user needs a VBA command to display the Excel Ribbon after it has been hidden.
Observed behavior
The Access DoCmd.ShowToolbar method is unavailable in Excel and cannot be used to control the Excel Ribbon.
Before you start

Open the workbook in Microsoft Excel and make sure macros are enabled for the file. Add the code to a standard VBA module or run it from an existing macro.

Solution 1Recommended

Show the Excel Ribbon with ExecuteExcel4Macro

Use this method when the Excel Ribbon has been hidden and you need to display it again from a VBA procedure.

DoCmd.ShowToolbar is a Microsoft Access command, so it is not supported in Excel VBA. Excel can use the legacy Excel 4 macro command SHOW.TOOLBAR through ExecuteExcel4Macro to control the Ribbon.

1
Open the Visual Basic Editor

In Excel, press Alt+F11 to open the Visual Basic Editor, then select Insert > Module to create a standard module.

2
Add the Ribbon display command

In the module, add this VBA line: ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",TRUE)"

3
Run the macro

Place the cursor inside the procedure and press F5, or return to Excel and select Developer > Macros to run the macro. The Excel Ribbon should appear.

Show the Excel Ribbon with ExecuteExcel4Macro
Ribbon restored: Using TRUE displays the Ribbon. This command is intended for Microsoft Excel, unlike DoCmd.ShowToolbar, which belongs to Access.
Free Microsoft Office alternative

Work with Excel Spreadsheets in WPS Office

If Microsoft Excel toolbar or VBA configuration is causing workflow issues, WPS Office provides a free, lightweight office alternative with a familiar spreadsheet interface. You can open and continue working with existing Excel files while moving to an easy-to-use workspace designed for seamless migration.

  1. 1. Install WPS Office: Download and install WPS Office, then open WPS Spreadsheets from the WPS Office home screen.
  2. 2. Open the Excel workbook: Select Open and choose the existing .xlsx or .xls workbook you want to continue editing.
  3. 3. Use spreadsheet commands: Use the Ribbon-style tabs in WPS Spreadsheets to access worksheet, formatting, and view tools.
Open and edit Microsoft Excel .xlsx and .xls workbooks with format compatibility.Use a familiar spreadsheet interface with Ribbon-style commands for common worksheet tasks.Get a free, lightweight office suite for everyday spreadsheet editing.Move existing Excel documents to WPS Office without converting them to a different file format.
microsoft office alternative - wps office

Frequently Asked Questions

Why does DoCmd.ShowToolbar fail in Excel VBA?

DoCmd.ShowToolbar is part of Microsoft Access automation and is not an Excel VBA method. In Excel, use ExecuteExcel4Macro with the SHOW.TOOLBAR command to control the Ribbon.

What VBA code shows the Excel Ribbon?

Use ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",TRUE)" in an Excel VBA procedure, then run the procedure from Developer > Macros or the Visual Basic Editor.

How do I hide the Excel Ribbon through VBA?

Use ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",FALSE)". Replace FALSE with TRUE in a separate restore macro so the Ribbon can be shown again.

Where should I place the Ribbon VBA code in Excel?

Press Alt+F11, select Insert > Module, and paste the code into the new standard module. You can then run it with F5 or from Developer > Macros.