When working on a database in Access 2007 it may be useful to hide the Ribbon Bar at the top of the screen.
We can do this manually by pressing Ctrl+F1 at anytime.
However, it may be useful to do this within VBA code.
We can do this by using the following code:
If Application.CommandBars("Ribbon").Height = 147 Then
SendKeys "^{F1}", True
End If
This will test the current size of the Ribbon Bar (which is in the Application.CommandBars collection).
If the Ribbon is currently shown its height will be 147.
We can use this information to test if the Ribbon Bar is currently visible and, if it is, to hide it by using the SendKeys function to send the Ctrl+F1 key combination.
Perhaps in the next version of office Microsoft will let use use Application.CommandBars(“Ribbon”).Visible=False!
If you found this useful you may like the following post regarding how to hide the Navigation Pane. (http://movefirstblog.wordpress.com/2008/09/10/access-2007-hide-the-navigation-pane-shutter-bar/)
Hi,
Your snippet of code didn’t quite work for me.
First, when I used a message box to show me the height of my ribbon, it said 55.
Second, regardless of whether it is hidden or not, the height kept saying 55, so the if then statement doesn’t work to determine whether the ribbon is currently hidden or not.
I would like to know if you have another way to determine whether the ribbon is hidden or not.
Thanks!