Activate and Deactive Tools Programmatically

Created:11/7/1999
Description:

The ActivateTool VBA macro shows how to make the built-in ArcMap Identify tool the active tool in ArcMap. The built-in ArcID module is used to get the unique identifer of the command. The DeactivateTool VBA macro deactivates the current tool in ArcMap; the application's current tool is set to nothing.

How to use:
  1. Paste these macros into a module in the Visual Basic Editor in ArcMap.
  2. Run the ActivateTool macro to make the Identify tool the active tool. Run the DecativateTool to make no tool active.
Sub ActivateTool()
  Dim pItem As ICommandItem
  Set pItem = Application.Document.CommandBars.Find(ArcID.Query_Identify)
  Set Application.CurrentTool = pItem
End Sub

Sub DeactivateTool()
  Set Application.CurrentTool = Nothing
End Sub