How To: Create label expressions using VBScript
This article contains some syntax examples for creating common label expressions using VBScript. Enter these expressions in the ArcMap Label Expression dialog box.
Note: The content in this article pertains to ArcGIS versions 8.x and 9.x. Later versions of ArcGIS may contain different functionality, as well as different names and locations for menus, commands and geoprocessing tools.
- Open the Label Expression dialog box in ArcMap.
Note: At ArcGIS Desktop versions 8.2 and later, click the Help button on the Label Expression dialog box to display more help on advanced label expressions.
- Use an ampersand (&) to append a text string to the Label Field.
"Name: " & [Name]
- Use the UCase function to convert the Label Field to upper case.
- Create a multiple-line label using the VbNewLine keyword.
"Name: " & [Name] & vbNewLine & "Type: " & [Type]
- Use the FormatCurrency function to display the Label as currency.
"Occupancy Revenue: " & FormatCurrency( [Maximum_Oc] * [Rate])
- Use the FormatNumber function to display labels for numeric items with trailing zeros.
"Occupancy: " & FormatNumber([OCCUPANCY_RATE],3)