property MenuButton.LastID as Long
Retrieves the last command identifier that was selected.

TypeDescription
Long A long expression that indicates the last identifier being selected.

The LastID property gets the identifier of the item being clicked.