property Item.Enabled as Boolean

Retrieves or sets a value indicating whether the item is enabled or disabled.

TypeDescription
Boolean A boolean expression indicating whether the item is enabled or disabled.

Use the Enabled property to enable or disable an item. The following sample shows how to add at runtime a disabled item:

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

The following sample shows how to disable an item after it was selected:

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (Button = 2) Then
        Dim nID As Long
        nID = PopupMenu1.ShowAtCursor
        If (nID = 1234) Then
            PopupMenu1.Command(1234).Grayed = True
        End If
    End If
End Sub