enable / disable submenu items

W

Wes Peters

I can not find any documentation on how to enable or disable submenu items
programatically.

I have a dropdown menu called Administration and under it are five
selections. I want to be able to programatically enable or disable the
selections based on a users login. The closest I can get is:

CommandBars("MainBar").Controls(1).Enabled = False

but that disables the whole dropdown menu. I can't find how to reference
the properties of the individual menu selections.

Thanks,
Wes
 
J

Jeff Conrad

Hi Wes,

The reason you did not find any documention is because you were looking in the wrong place. You can
find this topic under:
1-800-ASK-JEFF

You're very close on your attempt.
What you need to do is "walk-down" the command bars controls collection.

Here is an example:
 
J

Jeff Conrad

Oops, hit the Send button too soon!

Here is the example:
CommandBars("SwitchboardMenu").Controls("Tools").Controls("Administration").Enabled = False

The menu bar is SwitchboardMenu.
Under the Tools menu on the SwitchboardMenu I am disabling the Administration option.

Your example would be something close to this:

CommandBars("MainBar").Controls(1).Controls("WhateverOptionHere).Enabled = False
 
W

Wes Peters

Thanks Jeff!

That does the trick. I assume that if need be you could ".Controls(x)" as
deeply as you have menus nested.

Thanks again for your help.
Wes


Jeff Conrad said:
Oops, hit the Send button too soon!

Here is the example:
CommandBars("SwitchboardMenu").Controls("Tools").Controls("Administration").
Enabled = False
 
J

Jeff Conrad

You're welcome Wes, glad to help.
Yes, you can continue as far down the menu structure as you need to go using the same syntax.
 
Top