Move Selection Anchor to Polyon Label

Created:12/4/2000
Description:

This script moves the selection anchor to a polygon's label point. By default, ArcMap places the selection anchor at the center of the selected feature's envelope, which may or may not fall within the selected polygon.



How to use:
  1. Select one polygon feature.
  2. Paste the code into VBA and run the macro.
Public Sub PlaceAnchorPointatLabel()
  Dim pEditor As IEditor
  Dim pArea As IArea
  Dim pPolygon As IPolygon
  Dim pID as New UID
	  
  'Get a handle to the Editor
  pID = "esriCore.Editor"
  Set pEditor = Application.FindExtensionByCLSID(pID)
  
  If Not pEditor.SelectionCount = 1 Then Exit Sub
  
  'Get the selected feature and move the Editor's selection anchor
  'To the labelpoint of the polygon 
  If TypeOf pEditor.EditSelection.Next.Shape Is Polygon Then
    Set pPolygon = pEditor.EditSelection.Next.Shape
    Set pArea = pPolygon
    pEditor.SelectionAnchor.MoveTo pArea.LabelPoint, pEditor.Display
  End If
  
End Sub