How To: Extract characters from a string field to a new field using a space as a delimiter
Note: The information in this article applies to ArcGIS version 9.x only. Visual Basic for Applications (VBA) for ArcMap and ArcCatalog has been deprecated at ArcGIS 10.
Instructions provided describe how to extract characters from a string field to a new field using a space as a delimiter. This article contains a code sample that extracts all characters to the left of the first space and pastes them into another field.
Follow the steps below:
- Click Editor on the Editor toolbar and click Start Editing.
- Right-click the layer or standalone table in the Table of Contents and click Open Attribute Table.
- Right-click the field heading for the field in which the extracted characters are stored. Click Calculate Values.
- Click on the Advanced checkbox.
- Type the following VBA statement in the first text box:
dim space as integer space = instr([name], " ") dim var as string var = left([name], space)
Change [name] in lines 2 and 4 to the source field name.
- Type the variable var in the text box directly under the area field name.
- Click OK.