HOW TO

Change the number of decimals displayed in the ArcMap status bar with ArcObjects

Last Published: April 25, 2020

Summary

Below is a section of sample code which can change the precision of the coordinates displayed in the ArcMap status bar.

Procedure



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

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

  3. In the Project Explorer window, expand Project and select ArcMap Objects > ThisDocument then right-click and select View Code.
    [O-Image] Visual Basic Project  Explorer
    Note:
    It is currently a limitation in the software that the code must be executed in the Project and does not work when stored in the Normal.mxt.

  4. Copy the following code into the code module.

    Code:
    'Changes decimals that you see in the bottom of the ArcMap display

    Sub main()

    Dim pDoc As IMxDocument
    Dim pRepUnit As IReportUnitFormat
    Dim pNumericFormat As INumericFormat

    Set pDoc = ThisDocument
    Set pRepUnit = pDoc

    Set pNumericFormat = New NumericFormat
    With pNumericFormat
    .AlignmentOption = esriAlignRight
    .RoundingOption = esriRoundNumberOfDecimals
    .AlignmentWidth = 15
    .RoundingValue = 5
    .ShowPlusSign = False
    .UseSeparator = True
    .ZeroPad = False
    End With

    Set pRepUnit.NumericFormat = pNumericFormat

    End Sub

  5. Close the Visual Basic Editor.
  6. Run the code.

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

Article ID:000006137

Software:
  • ArcMap 9 x
  • 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