Dim pItem As ICommandItem Set pItem = CommandBars.Find(arcid.Query_Identify) '{B7FA188F-EBE3-11D0-87FE-080009EC732A} Set Application.CurrentTool = pItem
Private Sub cmdDrawPoly_Click() Dim fso As New FileSystemObject, sFolder As String Dim pAppRot As IAppROT, pDoc As IMxDocument, pWSF As IWorkspaceFactory, pFWS As IFeatureWorkspace Dim pFClass As IFeatureClass, pFLayer As IFeatureLayer2, pLayer As ILayer2, pCommItem As ICommandItem Dim pEditTask As IEditTask, iTaskCount As Integer, pCommBars As ICommandBars, pMap As IMap Dim pUID As New UID, pEditor As IEditor2 tbStatus.Text = "Setting up for you to draw polygons around your area of interest. Please wait!" ' snipped a bunch of flags and data checks subMakeNewFClass sFolder, "Custom_AON_Select_Layer.shp" 'add new fclass to map if gp is not set to add it ' snipped 'Close ArcCatalog if it is open... ' snipped 'turn on editing ' snipped 'Change the editing task... ' snipped 'works fine up to here... if I comment out the end I'm left with an open edit session, and the right task and target, only the tool remains whatever tool was in use when cmdDrawPoly got clicked. 'set current tool Set pCommBars = g_App.Document.CommandBars pUID = "{952C7CAC-29BC-11D3-9F37-00C04F6BC979}" Set pCommItem = pCommBars.Find(pUID) 'MsgBox 1 Set g_App.CurrentTool = pCommItem 'MsgBox 2 g_App.RefreshWindow cmdCreateSelectionLayer.Enabled = True tbStatus.Text = "Begin drawing. When you are done, click 'Create Selection Layer'!" 'Note: cmdCreateSelectionLayer closes the edit session if the user chose this method to highlight their AOI End Sub
Solved! Go to Solution.
pUID.Value = "{952C7CAC-29BC-11D3-9F37-00C04F6BC979}"
Craig,
Youre using the wrong guid, 952C7CAC* is the sketch tool palette.
The following post should help you.
Code to programmatically activate sketch tool?
Set pCommBars = g_App.Document.CommandBars pUID.Value = "{B479F48A-199D-11D1-9646-0000F8037368}" Set pCommItem = pCommBars.Find(pUID) Set g_App.CurrentTool = pCommItem