MenuItem Tag

I am trying to setup a simple custom contextual menu where I append an item and then set the tag. When I click an item, the text is fine but the tag is nil.

In ConstructContextualMenu

For Each TypeKey As Variant in keys base.Append(New MenuItem(d.Value(TypeKey).StringValue)) base.Tag = "TAG" Next

In ContextualMenuAction,

MsgBox "[R" + CStr(row) + ":C" +  CStr(column) + "] " + hitItem.Text + " (" + CStr(hitItem.Tag) + ")"

base.Tag = "TAG"

You’re setting the tag for the whole menu (base), not the tag of the specific menuitem.

For Each TypeKey As Variant in keys Dim mnu As New MenuItem(d.Value(TypeKey).StringValue) mnu.Tag = "TAG" base.Append(mnu) Next

As the brain gets older, the memory gets smaller and slower.

Thanx Andrew. That’s exactly what I was trying to do.