Option Explicit<o:p></o:p>
<o:p></o:p>
Public Sub MoveFeatures()<o:p></o:p>
Dim pEditor As IEditor<o:p></o:p>
Dim pID As New UID<o:p></o:p>
Dim pEnumFeature As IEnumFeature<o:p></o:p>
Dim pFeature As IFeature<o:p></o:p>
Dim mySet As ISet<o:p></o:p>
Dim pSpatialReference As ISpatialReference<o:p></o:p>
Dim pStartPoint As IPoint<o:p></o:p>
Dim pEndPoint As IPoint<o:p></o:p>
Dim pFeatureEdit As IFeatureEdit<o:p></o:p>
Dim pLine As ILine<o:p></o:p>
Dim origX As Double<o:p></o:p>
Dim origY As Double<o:p></o:p>
Dim Count As Integer<o:p></o:p>
<o:p></o:p>
'Get a reference to the editor extension<o:p></o:p>
pID = "esriEditor.Editor"<o:p></o:p>
Set pEditor = Application.FindExtensionByCLSID(pID)<o:p></o:p>
'Make sure something has been selected<o:p></o:p>
If pEditor.SelectionCount = 0 Then<o:p></o:p>
MsgBox "Nothing Selected"<o:p></o:p>
Exit Sub<o:p></o:p>
End If<o:p></o:p>
'Create an edit operation enabling undo/redo<o:p></o:p>
pEditor.StartOperation<o:p></o:p>
<o:p></o:p>
'Get the selection from the Editor and add all the features to a new Set<o:p></o:p>
Set pEnumFeature = pEditor.EditSelection<o:p></o:p>
Set mySet = New esriSystem.Set<o:p></o:p>
pEnumFeature.Reset<o:p></o:p>
For Count = 0 To pEditor.SelectionCount - 1<o:p></o:p>
Set pFeature = pEnumFeature.Next<o:p></o:p>
mySet.Add pFeature<o:p></o:p>
Next Count<o:p></o:p>
<o:p></o:p>
'Reset the Set<o:p></o:p>
mySet.Reset<o:p></o:p>
<o:p></o:p>
'MoveSet requires a line to specify the new location<o:p></o:p>
'Use the selection anchor as a starting point for the line<o:p></o:p>
Set pStartPoint = pEditor.SelectionAnchor.Point<o:p></o:p>
Set pLine = New Line<o:p></o:p>
pStartPoint.QueryCoords origX, origY<o:p></o:p>
Set pEndPoint = New Point<o:p></o:p>
pEndPoint.PutCoords (origX + 50), (origY + 0) 'offset the selection by 50 units in the x direction<o:p></o:p>
pLine.PutCoords pStartPoint, pEndPoint<o:p></o:p>
<o:p></o:p>
'Get the spatial reference from the map and assign it to the new line<o:p></o:p>
Set pSpatialReference = pEditor.Map.SpatialReference<o:p></o:p>
Set pLine.SpatialReference = pSpatialReference 'set the spatial reference of the new line<o:p></o:p>
<o:p></o:p>
'Do the move while looping through the set<o:p></o:p>
Do<o:p></o:p>
Set pFeatureEdit = mySet.Next<o:p></o:p>
If Not pFeatureEdit Is Nothing Then<o:p></o:p>
pFeatureEdit.MoveSet mySet, pLine 'Move all the selected features 60 units to the right<o:p></o:p>
Else<o:p></o:p>
Exit Do<o:p></o:p>
End If<o:p></o:p>
<st1:place w:st="on">Loop</st1:place><o:p></o:p>
<o:p></o:p>
'Stop the Edit Operation<o:p></o:p>
pEditor.StopOperation "Move Selection" 'String to appear in Edit menu<o:p></o:p>
<o:p></o:p>
'Refresh the Map to redisplay the moved features<o:p></o:p>
pEditor.Display.Invalidate Nothing, True, esriAllScreenCaches<o:p></o:p>
<o:p></o:p>
End Sub<o:p></o:p>