Is This Content Helpful?
How can we make this better? Please provide as much detail as possible.
Note: This article pertains to ArcGIS versions 8.x and 9.x. Later versions of ArcGIS may contain different functionality, as well as different names and locations for menus, commands and geoprocessing tools.
Instructions provide sample code to create a graphic buffer of selected features using IFeatureCursorBuffer.
Note: Support for Visual Basic for Applications (VBA) for ArcMap and ArcCatalog ended with the ArcGIS 10.2.2 release, and Esri has not included VBA compatibility setups since version 10.5. See: ArcGIS Desktop and VBA Moving Forward
Note: For more information on creating a UIControl, see the ArcGIS Desktop Help topic: 'Creating custom commands with VBA and UI Controls'
Dim pDoc As IMxDocument Dim pFCBuff As IFeatureCursorBuffer2 Dim pLayer As IFeatureLayer Dim pFS As IFeatureSelection Dim pSS As ISelectionSet Dim pSpatRef As ISpatialReference Dim pFeature As IFeature Dim pFCursor As IFeatureCursor Dim pCompGraphicsLayer As ICompositeGraphicsLayer Set pDoc = ThisDocument 'Set feature layer as the selected layer in the TOC Set pLayer = pDoc.SelectedLayer Set pFS = pLayer 'QI 'Grab the featureselection's selected set of features Set pSS = pFS.SelectionSet Set pSpatRef = pDoc.FocusMap.SpatialReference Set pCompGraphicsLayer = pDoc.FocusMap.BasicGraphicsLayer pSS.Search Nothing, False, pFCursor 'Loop through the featurecursor Set pFCBuff = New FeatureCursorBuffer 'set the properties for the featurecursorbuffer With pFCBuff Set .BufferSpatialReference = pSpatRef Set .DataFrameSpatialReference = pSpatRef .Dissolve = False Set .FeatureCursor = pFCursor Set .SourceSpatialReference = pSpatRef Set .SpatialReference = pSpatRef Set .TargetSpatialReference = pSpatRef .Units(pDoc.FocusMap.MapUnits) = 9 'Specify the buffer distance here .ValueDistance = 10 End With pFCBuff.BufferToGraphics pCompGraphicsLayer pDoc.ActiveView.Refresh