Louly wrote:
Hi everybody,
I got the code for dimming a menu item from this group after looking
for it for a long time thanks to those who share their experiences
with the others :)
The problem I'm facing is that it dims the wrong menu item!! Example,
if I write "DoCmd.SetMenuItem 0, 2, , acMenuGray", it dims the 3rd
command in the 2nd menu!! It's driving me crazy!
Thanks for your time and help :)
Lou
The numbering starts with zero so (2) is the index of the third item. From
the Help file...
*********************************************
DoCmd.SetMenuItem menuindex[, commandindex][, subcommandindex][, flag]
The SetMenuItem method has the following arguments.
menuindex
An integer, counting from 0, that's the valid index of a menu on the custom
menu bar or global menu bar for the active window, as defined in the menu
bar macro for the custom menu bar or global menu bar.
If you select a menu with this argument and leave the commandindex and
subcommandindex arguments blank (or set them to -1), you can enable or
disable the menu name itself. You can't, however, check or uncheck a menu
name (Microsoft Access ignores the acMenuCheck and acMenuUncheck settings
for the flag argument for menu names).
commandindex
An integer, counting from 0, that's the valid index of a command on the menu
selected by the menuindex argument, as defined in the macro group that
defines the selected menu for the custom menu bar or global menu bar for the
active window.
subcommandindex
An integer, counting from 0, that's the valid index of a subcommand in the
submenu selected by the commandindex argument, as defined in the macro group
that defines the selected submenu for the custom menu bar or global menu bar
for the active window.
flag
One of the following intrinsic constants:
acMenuCheck
acMenuGray
acMenuUncheck
acMenuUngray (default)
If you leave this argument blank, the default constant
(acMenuUngray) is assumed.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com