Results 1 to 3 of 3
  1. #1
    sgerber
    Guest

    "Graying out" a menu item

    The template I'm working on adds a drop-down menu to the main Word menu bar. Does anyone know if it's possible to disable items on that drop-down menu until a certain action is taken by the user?

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re:

    Steve,

    You don't say whether the template adds the drop-down menu programatically or whether the drop-down is part of the customizations built into the template.

    In any case, code like the following:
    CommandBars("Menu Bar").Controls("Custom Menu").Controls("Custom Item").Enabled = False

    will disable an item on a custom menu.

    So if you are creating the menu programatically, you can just set the Enabled property of the control to False, at the same time that you create it.

    If the control is a "manually built" part of the template, you could have a similar line of code in a Document_Open procedure so that the menu item is disabled by default whenever the template opens.

    And on the user action, you'd have code that would set Enabled to True - the trickiness of intercepting the user action depending on just what the action is.

    Gary

  3. #3
    sgerber
    Guest

    Re:

    >> You don't say whether the template adds the drop-down menu programatically or whether the drop-down is part of the customizations built into the template.

    In any case, code like the following:
    CommandBars("Menu Bar").Controls("Custom Menu").Controls("Custom Item").Enabled = False

    will disable an item on a custom menu. <<

    Gary,

    I built the menu "manually." (I wasn't aware at the time that it could be done programmatically.)

    In any case, this line of code does exactly what I needed.

    Thanks very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •