How do I get an existing ArcMap context menu so I can add a custom command to it?

1405
1
05-05-2011 01:49 PM
Occasional Contributor II
The title says it all. All I'm asking for is an entry into this problem.

I want to add some custom commands I have written to a context menu that already exists (the one that defaults when you right-click the active data view actually).

I imagine I can get the context menu using a GUID or name, and I'm pretty sure that there are methods that allow me add a command using its GUID or name to the context menu.

But I can't seem to get past the concept to start seeing the design and code :mad:

TIA
Reply
0 Kudos
1 Reply
New Contributor
Hi,
Below code might help..

Sub main()
Dim pUid As New UID
pUid.Value = "{3846A5B5-D3F8-44CB-BFA3-A5C30F4E535F}" ' Data view context menu

Dim pCmdBar As ICommandBar

Set pCmdBar = Application.Document.CommandBars.Find(pUid)

' Add some built-in ArcMap commands to the new toolbar
  pCmdBar.Add ArcID.File_AddData

pCmdBar.Popup
End Sub

Thanks
Nikhil
Reply
0 Kudos