custom menu display

S

Starbird

I have a template (in 2003) that has 3 custom menus in it. I need two of the
menus to be invisible if a user is an operator rather than developer. I have
an option upon opening the document to select either operator or developer.
When they select operator, I need 2 of the menus to be disabled and
invisible.

I located some code that looks like the following:

Word.CommandBars("MyTools MenuBar OP_Temp").Visible = False
Word.CommandBars("MyTools MenuBar OP_Temp").Enabled = False
Word.CommandBars("Formatting Toolbar Holder OP_Temp").Visible = False
Word.CommandBars("Formatting Toolbar Holder OP_Temp").Enabled = False

It errors out saying I am using an invalid command with "MyTools MenuBar
OP_Temp". I have tried a couple different things such as spacing between
Menu and Bar, using this as my foundation, but I'm getting nowhere.

I also tried writing a macro using the recorder to get the code from there.
It actually provides the desired end result but I'm afraid it's a very poor
way to resolve my issue and may create more problems than it's worth since it
doesn't reference the menu by name but by #. That code is:

CommandBars ("Menu Bar").Controls(12).delete

Any suggestions or insight would be greatly appreciated!!
Thanks!

SRD
 
T

Tom Winter

Are you talking about an actual separate toolbar (CommandBar), one that you
can drag around all by itself, or are you talking about an item on the
standard menu bar (next to File, Edit, etc.)?

If its a separate toolbar, then you want the current code, but you have to
know the name of the toolbar.

I assume your looking at a menu item on the standard menu bar. The code you
recorded is basically correct, but you need to put in the name of the menu:

CommandBars ("Menu
Bar").Controls("NameOfMenuItemAsItAppearsOnTheMenuBar").Whatever....

Hope that helps!
 
S

Starbird

Yes Tom, your assumption is correct, it is a menu item on the standard menu.
I did try it as your example shows, replacing the control # in the example I
originally sent with the actual name of the menu, but it didnot do what I
expected. In fact it did exactly the opposite and the third menu which I
wanted to remail visible is the one that disappeared. I know I'm close, just
must have something mixed up.
Thanks for your help Tom, at least I know I on the right track.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Adding custom menus to existing excel application 0
hide menu bar 1
auto enable macros 5
Stripping down excel 2
Run time error 2
Outlook Menu Toolbar 1
Filter For: menu item, custom menu 0
menu bar and error 91 3

Top