Hide the Ribbon programmatically in Access and Excel 2007

Developers don't like Office 2007 because the Ribbon is so hard to program. But if you're using Access and Excel, you can hide and display the Ribbon with a bit of help from VBA.

All of the Office 2007 applications sport the infamous Ribbon. Unfortunately for developers, the Ribbon object isn't as easy to control as its earlier counterpart, the command bar object. Access developers get a small bonus, as they can hide and show the Ribbon programmatically using the following commands, respectively: DoCmd.ShowToolbar "Ribbon", acToolbarNo DoCmd.ShowToolbar "Ribbon", acToolbarYes Most likely, you'll hide the Ribbon when you launch the database using an AutoExec macro or startup property. You could add a custom button that shows the Ribbon or simply hide and show the Ribbon as required. Excel users can use a similarly easy set of VBA statements to hide and display the Ribbon, respectively: Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"

Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"

How you execute the code is up to you. You can attach the hide code to ThisWorksheet's Open event to hide the Ribbon when a user opens the file. Or you might execute it when you launch a user form.

About Susan Harkins

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks