Dim pDisplayTable As IDisplayTable Set pDisplayTable = pFeatLayer Dim pSelSet As ISelectionSet Set pSelSet = pDisplayTable.DisplaySelectionSet Dim pCount As Integer pCount = pSelSet.count If pCount = 0 Then MsgBox "Nothing Selected" Exit Sub End If
Private Sub main() Dim pMxdoc As IMxDocument Set pMxdoc = ThisDocument If pMxdoc.FocusMap.SelectionCount = 0 Then MsgBox "No feature selected...Exiting" Exit Sub End If Dim pEnumFeature As IEnumFeature Set pEnumFeature = pMxdoc.FocusMap.FeatureSelection Dim pF As IFeature Set pF = pEnumFeature.Next Do Until pF Is Nothing ''do something with each feature Set pF = pEnumFeature.Next Loop End Sub
You could also use "pMxdoc.FocusMap.SelectionCount"