Closing Ribbon With VBA In Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fred Barnes
    New Member
    • Dec 2011
    • 1

    Closing Ribbon With VBA In Access

    I am trying to close the ribbon in my Access application so that the user will not have it available. I used the following code I found in a previous answer on this site.

    Code:
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    Interestingly enough, it worked exactly two times correctly and then stopped working.

    Any ideas on why it stopped working? Has anyone else had this happen?

    Thanks.
    Last edited by NeoPa; Dec 21 '11, 02:40 AM. Reason: Added mandatory [CODE] tags for you
  • tuxalot
    New Member
    • Feb 2009
    • 200

    #2
    I use the same code to close the ribbon. The code here removes the left navigation bar also. Works every time for me.

    Code:
        DoCmd.ShowToolbar "Ribbon", acToolbarNo
        DoCmd.SelectObject acTable, , True
        DoCmd.RunCommand acCmdWindowHide
    Re-enable with this:

    Code:
        DoCmd.ShowToolbar "Ribbon", acToolbarYes
        DoCmd.SelectObject acTable, , True
        DoCmd.SelectObject acForm, Me.Name

    Comment

    • TheSmileyCoder
      Recognized Expert Moderator Top Contributor
      • Dec 2009
      • 2322

      #3
      You need to be more exact when you say "stopped" working.

      When debugging, (and Before posting), always start by making absolutely sure that your code is run. You can look in our Access insights section for some articles on debugging in VBA, but a simply way for a "novice" is to simply add a msgbox preceeding the statement in question:
      Code:
      MsgBox "About to turn off Ribbon"
      DoCmd.ShowToolbar "Ribbon", acToolbarNo

      The reason I bring this up, is that from what little information you have given, my best guess is that your code is simply not firing/executing.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32634

        #4
        These may help :

        Comment

        Working...