By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,645 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Closing Ribbon With VBA In Access

P: 1
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.

Expand|Select|Wrap|Line Numbers
  1. 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?

Dec 20 '11 #1
Share this Question
Share on Google+
3 Replies

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

Expand|Select|Wrap|Line Numbers
  1.     DoCmd.ShowToolbar "Ribbon", acToolbarNo
  2.     DoCmd.SelectObject acTable, , True
  3.     DoCmd.RunCommand acCmdWindowHide
Re-enable with this:

Expand|Select|Wrap|Line Numbers
  1.     DoCmd.ShowToolbar "Ribbon", acToolbarYes
  2.     DoCmd.SelectObject acTable, , True
  3.     DoCmd.SelectObject acForm, Me.Name
Dec 21 '11 #2

Expert Mod 100+
P: 2,321
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:
Expand|Select|Wrap|Line Numbers
  1. MsgBox "About to turn off Ribbon"
  2. 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.
Dec 21 '11 #3

Expert Mod 15k+
P: 31,494

Post your reply

Sign in to post your reply or Sign up for a free account.