Note:Code in the Project's ThisDocument code module will only run in the current map document. If you want to store the code in all your map documents, open the Normal.mxt ThisDocument code module instead.

Paste the following code into the code module

Code:Sub Main()

Dim pDoc As IMxDocumentDim pLayer As IGeoFeatureLayerDim pFS As IFeatureSelectionDim pSS As ISelectionSet

Set pDoc = Application.Document

'Make certain that the layer is selected in the TOCSet pLayer = pDoc.SelectedLayerSet pFS = pLayer 'QISet pSS = pFS.SelectionSet

DisplayOnlySelectedFeatures pLayer, pSS

'Refresh Data FramepDoc.ActiveView.Refresh

End Sub

Public Sub DisplayOnlySelectedFeatures(pGlayer As IGeoFeatureLayer _ , pSelectionset As ISelectionSet)

'Declare variablesDim pFCEntire As IFeatureCursorDim pSelFC As IFeatureCursorDim lEntireOID As LongDim lSelOID As LongDim pFeatureIDSet As IFeatureIDSetDim pEntireEnumId As IEnumIDsDim pSelEnumIds As IEnumIDsDim pEntireSelSet As ISelectionSet

'Loop through the selected feature's oids and check to see'if the featureidset contains any of them.'If so, remove them.Do Until lSelOID = -1 If pFeatureIDSet.Contains(lSelOID) Then pFeatureIDSet.Remove (lSelOID)End IflSelOID = pSelEnumIds.NextLoop

'Set the exclusion featureidset to that of the geofeaturelayerSet pGlayer.ExclusionSet = pFeatureIDSet