Вешаешь на кнопочку следующую лабуду
(взято откуда-то из примеров или с их сайта):
Dim pDoc As IMxDocument
Dim pMap As IMap
Set pDoc = ThisDocument
Set pMap = pDoc.FocusMap
'-- Get the first layer
Dim pFLayer As IFeatureLayer
Set pFLayer = pMap.Layer(0)
Dim pFc As IFeatureClass
Set pFc = pFLayer.FeatureClass
'-- Check to see if layer already has an area field
If Not pFc.FindField("Area") = -1 Then
MsgBox "Area already exists"
Exit Sub
End If
'-- Create a field called Area
Dim pField As IField
Set pField = New Field
Dim pFieldEdit As IFieldEdit
Set pFieldEdit = pField
With pFieldEdit
.Name = "Area"
.Type = esriFieldTypeDouble
.Precision = 11
.Length = 12
.Scale = 3
End With
pFc.AddField pField
'-- Loop through the features and get the area
Dim pFCursor As IFeatureCursor
Set pFCursor = pFLayer.Search(Nothing, False)
Dim pFeat As IFeature
Set pFeat = pFCursor.NextFeature
Do Until pFeat Is Nothing
Dim pArea As IArea
If pFeat.Shape.GeometryType = esriGeometryPolygon Then
Set pArea = pFeat.Shape
pFeat.Value(pFc.FindField("Area")) = pArea.Area
pFeat.Store
End If
Set pFeat = pFCursor.NextFeature
Loop