Add a row to an INFO file using VBA and ArcMap

Last Published: April 25, 2020


This article shows how to create and populate a new row in an INFO table.


  1. Open ArcMap.
  2. Open the Visual Basic Editor.

    In ArcMap, select Tools > Macros > Visual Basic Editor.

  3. In the Project Explorer window, expand Project.mxt and select ArcMap Objects > ThisDocument. Right-click and select View Code.
    [O-Image] Visual Basic Project  Explorer
    Code in ThisDocument code module will only run in the current map document. To store the code in all map documents, open the code in the Normal.mxt ThisDocument code module.

  4. Paste the following code into the code module.

    Sub AddRow()

    Dim pWorkspace As IWorkspaceFactory
    Set pWorkspace = New ArcInfoWorkspaceFactory
    Dim pFeatureWorkspace As IFeatureWorkspace
    Set pFeatureWorkspace = pWorkspace.OpenFromFile("c:\temp", 0)
    Dim pWorkspaceEdit As IWorkspaceEdit
    Set pWorkspaceEdit = pFeatureWorkspace
    Dim pTable As ITable
    Set pTable = pFeatureWorkspace.OpenTable("owner.dat")

    'Start an edit session
    pWorkspaceEdit.StartEditing True

    'Add the row
    Dim pRow As IRow
    Set pRow = pTable.CreateRow
    pRow.Value(1) = "Gilbert"

    'Stop the edit session
    pWorkspaceEdit.StopEditing True

    End Sub

  5. Modify the workspace path, INFO file name and values to be added.
  6. Close the Visual Basic Editor.
  7. Run the code.

    A. Click Tools > Macros > Macros to display the Macros dialog box.
    B. Select a macro and click Run.

Article ID:000004963

  • ArcMap 8 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options