HOW TO
This article shows how to add a new item to a coverage feature class in ArcMap.
Note:
Code in ThisDocument module will only run in the current map document. To store the code in all your map documents, open the Normal.mxt ThisDocument code module.
Code:
Public Sub additem()
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pFLayer As IFeatureLayer
' Get the first layer in ArcMap
Dim pCovFClass As ICoverageFeatureClass
Set pFLayer = pMxDoc.FocusMap.Layer(0)
Set pCovFClass = pFLayer.FeatureClass
Dim pArcItem As IArcInfoItem
Dim pArcItemEdit As IArcInfoItemEdit
Dim pFClass As IFeatureClass
Set pFClass = pFLayer.FeatureClass
Dim pArcTable As IArcInfoTable
Set pArcTable = pCovFClass
' Check to see if an item called newitem exists
' and create the item if it doesn't
If pFClass.FindField("newitem") = -1 Then
Set pArcItem = New ArcInfoItem
Set pArcItemEdit = pArcItem
With pArcItemEdit
.Name = "newitem"
.Type = esriFieldTypeString
.Width = 1
.OutputWidth = 1
End With
pArcTable.additem pArcItem, "test"
End If
Get help from ArcGIS experts
Download the Esri Support App