Welcome to MSDN Blogs Sign in | Join | Help

Microsoft Access 2010

The official blog of the Microsoft Access product team

News

  • Tell us your story how Access has helped you pursue your potential or business‘s success.
Using the ShowToolbar Method to Hide the Ribbon

Today’s guest blogger is Edwin Blancovitch. Edwin is president of Advanced Developers.net, creators of Easy Payroll, a software package to manage your human resources, payroll, scheduling, time and attendance needs.

I have been using the ribbon for the last two years and I like it so much, however there was a situation where I wanted to hide the ribbon. I used the Minimize the Ribbon command to hide it, but there was still some space being used by the Office button and the ribbon tabs.

image

After some experimentation and some research I found that I could use the ShowToolbar method to hide the ribbon. The following line of code makes the ribbon disappear completely, and allows you to see the application like in Office 2003, without the command bars.

DoCmd.ShowToolbar "Ribbon", acToolbarNo

That will make the ribbon disappear completely, and allow you to see the application like in Office 2003, without the command bars.

image

To display the ribbon again, use this code:

DoCmd.ShowToolbar "Ribbon", acToolbarYes

I wrote an article a long time ago for creating context command bars with VBA code, now it will be great to experiment by creating new command bars that go in the top menu. You can use context command bars in your forms, and make it work the way you wanted.

Posted: Friday, October 16, 2009 10:31 PM by Mike Stowe
Filed under: ,

Comments

Kuwait10 said:

Great tips thanks for sharing.

# October 17, 2009 2:29 AM

Joe said:

Thanks bro, youre a star! Thanks for the sharing, i have been searching for this tip for 4 days. You are a life saver.

# October 17, 2009 6:30 AM

Joe said:

Once again, man. I thank you for the sharing. The code you contributed made me finally finish my app. Cheers!

# October 17, 2009 8:37 PM

Joe said:

Hello Edwin,

Sorry to bother you, but do you have any idea of how to create accde file after disabling the ribbon. Is there any hotkey to that? Or the alternative is how to use vba to disable design view of the form. Could you just spend a few minutes to help me out of here? THANKS again mate!

# October 17, 2009 9:23 PM

Edwin Blancovitch said:

JOE!

I’m happy to see you like this TIP, and it has been useful to you; that was the purpose . . .

There are some important topics about your question, It can be very easy, but it can get complicated, this is based on your specific needs, let me explain.

We have been doing this since 1997, there was no ribbon at that time, but there were MDE's files, and there is some code that we run to specifically when MDE’s or ACCDE, for example, as access developers we distribute the ACCDE or MDE, but when the file is an ACCDB or MDB, we allow certain stuff like “pressing the shift key at start up, and go into design mode”.

If ACCDE or MDE the user will never go to design mode, so why should we allow the pressing of Shift key?,  we run certain code to see if the distributed file is an MDE or MDB or ACCDB or ACCDE or ACCDR based on the file type, we disable the shift key at startup. . .

This code also can be run to disable the Ribbon or Enable the ribbon.

But in a very basic case you should just disable the ribbon in the autoexec macro by calling a macro or vba code, so in your development you will just press the shift key and the code will never run. .

Or you can have a macro to enable or disable the ribbon.

Hope this helps, for any more doubts, you kno where to find me. . .

# October 19, 2009 11:41 AM

Dena Coe said:

I really do not like the ribbon! I prefer the toolbar, and it is faster. The ribbon is annoying and waste too much time trying to find tools that I need in a hurry. I have been using Office for 10 years, and this is the first year I have uninstalled 2007 and went back to 2003 version! I have hidden the ribbon many times, and then I wondered, "why bother with it", just go back to 2003. Plus office 2007 is a memory HOG! and I should not have to buy more just for office. My computers are all up on memory already!

# October 19, 2009 12:01 PM

Vladimir Cvajniga said:

Dena Coe: Recently, there was a discussion about Ribbon on one of Czech forums. Some people say they like Ribbon. But most people hate it and thus they are switching to Open Office. But Access is a specific application with no alternative in Open Office. :-( I mean, OOBase is not an alternative.

# October 20, 2009 7:58 AM

Vladimir Cvajniga said:

When I hide Ribbon only one Close button is available in my application. It is Access's Close button, ie. there is no Close button on any form/report (child window in MDI). That's why I don't find DoCmd.ShowToolbar "Ribbon", acToolbarNo of any use. Maybe I'm doing something wrong.

# October 20, 2009 8:03 AM

Alan Cossey said:

Vladimir,

I still have a Close button on my forms when I use DoCmd.ShowToolbar "Ribbon", acToolbarNo unless I have set the "Close Button" property of the form to "No".

# October 22, 2009 11:13 PM

Vladimir Cvajniga said:

Alan: I have made a few screenshots so that you can see what happens here. Worst of all: QAT is not available when the Ribbon is off.

Screenshots: www.alis.cz/relax/download/access/Blog/Ribbon_acToolbarNo.zip

# October 29, 2009 6:24 AM
New Comments to this post are disabled
Page view tracker