Access 2007 – Hide the Ribbon Bar

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. (https://movefirstblog.wordpress.com/2008/09/10/access-2007-hide-the-navigation-pane-shutter-bar/)

Advertisements

7 Responses to “Access 2007 – Hide the Ribbon Bar”


  1. 1 David August 26, 2009 at 11:13 pm

    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!

  2. 2 Rick March 1, 2010 at 2:44 am

    I couldn’t get the code listed above to work, but I figured it out because of it…Enjoy!

    Public Sub ShowNavPane()
    DoCmd.SelectObject acTable, , True ‘Auto unhides the nav pane
    End Sub

    Public Sub HideNavPane()
    DoCmd.SelectObject acTable, , True ‘selects the nav pan
    DoCmd.RunCommand acCmdWindowHide ‘hides the nav pane.
    End Sub

    Rick

  3. 3 Crispin October 9, 2010 at 7:20 pm

    To hide or show the Access ribbon just create two functions in a module like this, and then you can call these with the RunCode action in any macro, e.g. your AutoExec startup.
    Public Function ShowRibbon()
    DoCmd.ShowToolbar “Ribbon”, acToolbarYes
    End Function
    Public Function HideRibbon()
    DoCmd.ShowToolbar “Ribbon”, acToolbarNo
    End Function


  1. 1 Access 2007 - Hide the Navigation Pane / Shutter Bar « MoveFirst Weblog Trackback on September 10, 2008 at 4:04 pm
  2. 2 Navigation Pane Trackback on June 7, 2009 at 9:15 am
  3. 3 How to reduce ribbon height Trackback on November 9, 2010 at 3:38 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Blog Stats

  • 222,048 hits

Counter

ClustrMap


%d bloggers like this: