property Command.Grayed as Boolean

Retrieves or sets a value that indicates whether the item menu is enabled or disabled.

TypeDescription
Boolean A boolean expression that indicates whether the item menu is enabled or disabled.

Use the Grayed property to enable or disable an item. the Command property of the control to get a Command object based on the item's identifier. The following sample shows how to disable an item:

PopupMenu1.Command(1234).Grayed = True

The following sample shows how to add an disabled item:

With PopupMenu1.Items
.Add("Item", Default, 1234).Enabled = True
End With