469,270 Members | 1,063 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

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.

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?

Thanks.
Dec 20 '11 #1
3 4013
tuxalot
200 100+
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
TheSmileyCoder
2,321 Expert Mod 2GB
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
NeoPa
32,171 Expert Mod 16PB
These may help :
Dec 21 '11 #4

Post your reply

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

Similar topics

1 post views Thread by u7djo | last post: by
22 posts views Thread by alecjames1 | last post: by
1 post views Thread by Vegar Hansen | last post: by
6 posts views Thread by news.microsoft.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.