Show the Microsoft Excel Ribbon and Restore the Toolbar with VBA
Question details
Show the Microsoft Excel Ribbon again and restore access to the worksheet toolbar area by using 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.
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.
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.
In Excel, press Alt+F11 to open the Visual Basic Editor, then select Insert > Module to create a standard module.
In the module, add this VBA line: ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",TRUE)"
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.

Hide the Excel Ribbon with the same VBA command
Use this variation only when you want a macro to hide the Ribbon again after confirming that users can restore it when needed.
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. Install WPS Office: Download and install WPS Office, then open WPS Spreadsheets from the WPS Office home screen.
- 2. Open the Excel workbook: Select Open and choose the existing .xlsx or .xls workbook you want to continue editing.
- 3. Use spreadsheet commands: Use the Ribbon-style tabs in WPS Spreadsheets to access worksheet, formatting, and view tools.

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.




