English

How To: Set ArcMap display units to decimal degrees programmatically

Summary

By default, ArcMap uses the Degrees Minutes Seconds format when setting the Map display units to esriDecimalDegrees. How can the display units setting be changed to decimal degrees?

Procedure

Setting map display units to decimal degrees requires the IReportUnitFormat interface in addition to setting the DistanceUnits property on IMap. The following Visual Basic for Applications (VBA) script shows how to use IReportUnitFormat.

Note:
At ArcGIS Version 10, VBA was deprecated and a separate license is required. To use this code, please contact your Esri account representative for a VBA license for 10.


Code:
Sub SetDisplayUnitsDD()

Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument

Dim pMap As IMap
Set pMap = pMxDoc.FocusMap

Dim pReportUnitFormat As IReportUnitFormat
Set pReportUnitFormat = pMxDoc

Set pReportUnitFormat.LatLonFormat = Nothing

pMap.DistanceUnits = esriDecimalDegrees

End Sub