VBA Enable Shortcut Menu Bar?

thotovec
thotovec used Ask the Experts™
on
Hello Experts!

While testing my application, I found a number of users were inadvertently using the various command and menu bars.  To alleviate this, EE gave me a great routine I run at startup which disables all of bars -

    Dim i As Integer
    For i = 1 To CommandBars.Count
    Application.CommandBars(i).Enabled = False
    Next i

After this runs, I also have code for a custom Menu Bar I created which gives users everything they need.
    CommandBars("Custom Menu Bar").Enabled = True
    CommandBars("Custom Menu Bar").Visible = True

This works great for users - but I very much need the shortcut menu bar (right click of the mouse)!  What is this shortcut bar called and how can I add this to my VBA?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
See this link:

http://www.jamiessoftware.tk/articles/menubars.html
       
Not sure it that article mentions it, but ... when you are in the Customize mode (dialog) ... if you hold down the Control key, you can drop and drag (ie, copy) menu items from one place to another ... handy for making a new menu that is similar another one.

mx
Top Expert 2006

Commented:
the property of the form called

"Shortcut Menu"

if that is set to No then u cannot use right click
and if set to Yes then u can

so set that property to yes then set  your menu bar in the form
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Also:

From the menu:
View>>Toolbars>Customize
On the Toolbars tab, check off 'Shortcut Menus

A menu bar will appear in the upper right ... showing all custom right click menus.

mx
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Thanks for the insights - but maybe I'm not getting my point across.

Just trying to get the "right click" standard shortcut menu bar to appear -

Not a custom menu, the standard menu.

Appears in all other application, just not access.

I thought it was related to the code I typed above.

Ideas?
Database Architect / Application Developer
Top Expert 2007
Commented:
Try running this:

    Dim i As Integer
    For i = 1 To CommandBars.Count
    Application.CommandBars(i).Enabled = True
    Application.CommandBars(i).Visible= True
    Next i

mx

Author

Commented:
mx -

have you done this?

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Not a the moment, but I have in the past.
All of my toolbars / menus are fine ... and all are customized also.

mx

Author

Commented:

The explosion on the screen is a work of art!

Now I just have to figure out which is which . . .
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
explosion ?

fireworks?

mx
Top Expert 2006

Commented:
LOL
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
thotovec ... what happened?  menu bar R US ??

Author

Commented:

I tried this earlier today - which is why I asked if you've done it before.

Every menu and tool bar in Access is now open on the screen.

Its strangely appealing.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
But, you can just simply close the ones you don't want, right?


Did you get back what you needed?  Big bang for the buck, right, lol?

mx
Top Expert 2006

Commented:
>>Its strangely appealing. Cascade them!! ROTF!!

Author

Commented:
VERY big bang -

And yes - got everything back - 43 tool or command bars at last count!

So, thanks?  I guess?

Still trying to figure out which groups are the shortcut menu bar on the right mouse click!
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
"Still trying to figure out which groups are the shortcut menu bar on the right mouse click!"

This:

From the menu:
View>>Toolbars>Customize
On the Toolbars tab, check off 'Shortcut Menus

A menu bar will appear in the upper right ... showing all custom right click menus.

Every thing else are menus and toolbars ...

mx
Top Expert 2006
Commented:
this one says that there are certain properties that can't be set except at runtime.
I am still reading through it...but this is not really a matter of making menus visible or not, but enabling and disabling correct? Toward the bottom it gets interesing.

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20704925.html

Author

Commented:

Well, I can definitely say I don't want to go down this path again!

The code I wrote at the beginning of the thread turns off EVERY POSSIBLE "bar" - menu bars, tool bars, custom bars, "hidden" bars, shortcut bars, you name it.

So after the reversal of the code (thanks dmx) - and the subsequent explosion of bars on my screen - I went thru and detailed which were tool bars (View -> Tool Bars -> Customize).  If you were wondering, Access has 33 tool bars - I will post the list in a second.

The ONE bar that was never visible - the ONLY ONE I was looking for - was the SHORTCUT MENUS TOOL BAR.

The only way I found to get to it back was thru Tools -> Startup and check "Allow Default Shortcut Menus".

So thanks everyone for the suggestions - and I will never touch another tool bar again.

And here's the list:

   1  Alignment and Sizing
   2  Database
   3  Diagram Design
   4  Filter/Sort
   5  Form Design
   6  Form View
   7  Formatting (Datasheet)
   8  Formatting (Form/Report)
   9  Formatting (Page)
   10  Formatting (PivotTable/PivotChart)
   11  Function Design
   12  Macro Design
   13  Menu Bar
   14  Page Design
   15  Page View
   16  PivotChart
   17  PivotTable
   18  Print Preview
   19  Query Datasheet
   20  Query Design
   21  Relationship
   22  Report Design
   23  Source Code Control
   24  Stored Procedure Design
   25  Table Datasheet
   26  Table Design
   27  Task Pane
   28  ToolBox
   29  Trigger Design
   30  Utility 1
   31  Utility 2
   32  View Design
   33  Web






DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Just Say No (picture a red line through a toolbar) :-)

Hey ... thanks for the list ... logged and noted.

mx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial