This example displays a message box containing the context string for the command bar named “Custom”. This example works in Microsoft Word and other applications that support the Context property.
Set myBar = CommandBars _
.Add(Name:="Custom", Position:=msoBarTop, _
Temporary:=True)
With myBar
.Controls.Add Type:=msoControlButton, ID:=2
.Visible = True
End With
MsgBox (myBar.Context)