Add an ArcInfo annotation layer to ArcMap with ArcObjects

Last Published: April 25, 2020


This article pertains to ArcGIS versions 8.x. Later versions of ArcGIS may contain different functionality, as well as different names and locations for menus, commands and geoprocessing tools.

This VBA example illustrates how to add an ArcInfo annotation layer to ArcMap programmatically using ArcObjects.

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


  1. Start ArcMap.
  2. Create a new UIButtonControl: How To: Create a new UIButtonControl
 For more information on creating a UIControl, see the ArcGIS Desktop Help topic: 'Creating custom commands with VBA and UI Controls'
  1. Right-click the UIButtonControl and select View Source.
  2. Copy this code into the UIButtonControl's click event.
'''This code loads an ArcInfo 7.x Annotation Coverage 

Dim a_wf As IWorkspaceFactory
Set a_wf = New ArcInfoWorkspaceFactory

Dim b_fc As IFeatureWorkspace
Set b_fc = a_wf.OpenFromFile("d:\coverages", 0)

Dim pWorkspace As IWorkspace
Set pWorkspace = b_fc

Dim pFeatClass As IFeatureClass
Set pFeatClass = b_fc.OpenFeatureClass("box:annotation")

'Note: If the annotation has a subclass, the syntax becomes

Dim pCovLayer As IFeatureLayer
Set pCovLayer = New CoverageAnnotationLayer
Set pCovLayer.FeatureClass = pFeatClass

Dim pDataset As IDataset
Set pDataset = b_fc
pCovLayer.Name = pDataset.Name

Dim pDoc As IMxDocument
Set pDoc = ThisDocument

pDoc.AddLayer pCovLayer

Article ID:000004589

  • ArcMap 8 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic