MSAccess - Minimize the Toolbar Ribbon OnLoad()?

Here's a snippet of my implementaion:

Select Case SysCmd(acSysCmdAccessVer)
    Case 7: accVer = "95"
    Case 8: accVer = "97"
    Case 9: accVer = "2000"
    Case 10: accVer = "2002"
    Case 11: accVer = "2003"
    Case 12: accVer = "2007"
    Case 13: accVer = "Pirated!"
    Case 14: accVer = "2010"
    Case 15: accVer = "2013"
    Case Else: accVer = "Unknown"
End Select

RibbonState = (CommandBars("Ribbon").Controls(1).Height < 100)

Select Case RibbonState
    Case True
        'Do nothing, already minimized
    Case False
        If accVer > 13 Then
            CommandBars.ExecuteMso "MinimizeRibbon"
        Else
            SendKeys "^{F1}", False
        End If
End Select

Check out this answer on MSDN. He shares a few different ways to go about it, including a sample database.

E.G. In Access 2010 you can change the Ribbon state with:

CommandBars.ExecuteMso "MinimizeRibbon"

http://social.msdn.microsoft.com/Forums/office/en-US/2f0d95a8-ed5f-4007-831d-05ef7e7a4263/minimize-the-ribbon-at-access-startup-using-vba

He links within:

http://www.accessribbon.de/en/index.php?FAQ:19

http://www.accessribbon.de/en/index.php?Downloads:15

Based on what access is being used, you could use different functions, perhaps.

Taking this from - http://windowssecrets.com/forums/showthread.php/142262-How-to-find-Access-version-in-code:

Public Function AccessVersionID() As String


   Select Case SysCmd(acSysCmdAccessVer)
     Case 7: AccessVersionID = "95"
     Case 8: AccessVersionID = "97"
     Case 9: AccessVersionID = "2000"
     Case 10: AccessVersionID = "2002"
     Case 11: AccessVersionID = "2003"
     Case 12: AccessVersionID = "2007"
     Case 13: AccessVersionID = "Pirated!"
     Case 14: AccessVersionID = "2010"
     Case 15: AccessVersionID = "2013"
     Case Else: AccessVersionID = "Unknown"
   End Select

 End Function            'AccessVersionID()

Just moved to Access 2016. My database uses similar code to that provided by Dave Stuart. Looks like minimized ribbon now has height of '102', so have used (e.g.):

If CommandBars("ribbon").Height > 120 Then
  CommandBars.ExecuteMso "MinimizeRibbon"
End If

Access 2010 version and up you should do this in your start-up form. If you just use the ExecuteMso line ONLY it will TOGGLE your Ribbon each time that form opens. To always minimize the Ribbon on Startup then I use the following code.

If CommandBars("ribbon").Height > 100 Then
    CommandBars.ExecuteMso "MinimizeRibbon"
End If

Hope this Helps some who is looking for the answer to this like myself

Dave

Tags:

Ms Access

Vba