I have a UI tool button, I would like to get and use the existing function (select elements tool) in Arcmap when I activate this button, does anybody know that how to call the existing function using Vb arcobjects ??


You can use the ArcMap Commands, eg.

  Dim pUID As New UID
  Dim pCmdItem As ICommandItem
  ' Use the GUID of the Save command
  pUID.Value = "{161496AD-AC99-11D2-87F8-0000F8751720}"
  ' or you can use the ProgID
  ' pUID.Value = "esriArcMapUI.EditSelectAllCommand"
  pUID.SubType = 3
  Set pCmdItem = Application.Document.CommandBars.Find(pUID)

Or, check out this forum post to grab elements on mouse up event.



Not sure if I understand you correctly, but would it not make sense to explicitly GET the tool you want...just in case the user has not selected it? It's OK to set it if it's already set.

Dim pCmdBar As ICommandBar
Dim pCmdItem As ICommandItem
Dim pUID As New UID

Set pCmdItem = Document.Parent.Document.CommandBars.Find(ArcID.PageLayout_SelectTool)
Set ThisDocument.Parent.CurrentTool = pCmdItem

Note that ArcID.PageLayout_SelectTool is for ArcGIS 10, in 9.3 it was Select_Elements I think.

Hope this helped.

  • thanks for your answering ! I solved the problem ! thanks !!! – Emma Feb 27 '12 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.