Sub ArcText()
' tested with USHighways shape file in layer(0)
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pGFLayer As IGeoFeatureLayer
Set pGFLayer = pMxDoc.FocusMap.Layer(0)
pGFLayer.AnnotationProperties.Clear
Dim pLLP As ILineLabelPosition
Set pLLP = New LineLabelPosition
With pLLP
.Above = False
.AtEnd = False
.Below = False
.Horizontal = False
.InLine = True
.OnTop = True
.Parallel = True
.ProduceCurvedLabels = False
End With
Dim pLELP As ILabelEngineLayerProperties
Set pLELP = New LabelEngineLayerProperties
With pLELP
Set .Symbol = New TextSymbol
.IsExpressionSimple = True
.Expression = "[rsd111wpt.WAYPOINTNO]"
.BasicOverposterLayerProperties.LineLabelPosition = pLLP
End With
Dim pALP As IAnnotateLayerProperties
Set pALP = pLELP
With pALP
.DisplayAnnotation = True
Set .FeatureLayer = pGFLayer
.LabelWhichFeatures = esriVisibleFeatures
.WhereClause = "rsd111wpt.WAYPOINTNO"
End With
pGFLayer.AnnotationProperties.add pLELP
pGFLayer.DisplayAnnotation = True
pMxDoc.ActiveView.Refresh
End Sub |