My code selects a feature on a particular layer if found at the point where teh user selects on the map. It then prompts a confirmation to delete the selected feature. If the user chooses "No", I want the selected feature to un-highlight. I'm trying to use the Layer>Highlight method which should unhighlight if given the value zero for the Bookmark argument.
When I run it, I get the error: "Object doesn't support this action."
How do I correct this line item to work properly?
I've included the whole sub, and the line in question is near the bottom "objLayer.Highlight(0)".
Sub DeleteGPSValve
Dim dblX, dblY, blnFound, objLayer, sMessage, sOK
'Get the coordinates of the map where the user clicked
dblX = Map.PointerX
dblY = Map.PointerY
'Initialize blnLyrExists flag to False
blnFound = False
sMessage = "Delete the selected GPSValve?"
For Each objLayer in Map.Layers
If objLayer.name = "GPSvalves" Then
if objLayer.CanEdit = False then
msgbox "GPSValves are not available for editing."
exit sub
end if
objLayer.Editable = True
'If features are found set the blnFound flag to true
blnFound= Map.SelectXY(dblx,dbly)
If blnFound Then
Exit For
End If
End If
Next
'If no feature was selected during above loop, exit
If Not blnFound Then
msgbox "no GPSValve found"
Exit Sub
End If
Dim objRS
Set objRS = objLayer.Records
objRS.Bookmark = Application.Map.SelectionBookmark
sOK=msgbox(sMessage, vbYesNo, "delete?")
select case sOK
case vbyes
objRS.delete
objRS.update
Application.Map.Refresh(True)
case vbno
objLayer.Highlight(0)
exit sub
end select
set objRS = Nothing
End Sub