View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Hide ribbon or menu bar in Excel 2007

This totally hides/shows the ribbon:

Sub HideRibbon()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub

Sub ShowRibbon()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub

This is probably an oversight by MS since the VBA equivalent does not hide
the ribbon. Now that it's public it may not survive the first SP.

You'd still need to run your code to kill the various context (right-click)
menus.

--
Jim
"Shahin.H" wrote in message
...
| Hi everybody,
| Does anybody know how to hide ribbon or menu bar in Excel 2007 using VBA
code?
| I applied following solution:
|
| Dim iCounter As Integer
| For iCounter = 1 To CommandBars.Count
| Application.CommandBars(iCounter).Enabled = False
| Next
|
| This code works in Excel 2003, however it does not work in Excel 2007?
|
| I would be very grateful if anybody could help me.
|
| Best regards,
| Shahin
|