I have come to realise that hundreds of my MXD files have the scalebar units label spelled as "Meters" instead of "Metres". I suspect this is something I am going to have to do manually (I don't know ArcObjects).

Looking at the MAPSURROUND_ELEMENT class documentation, it doesn't appear that this is something I can change using arcpy.

Is there a way to change the spelling of the units label in my scalebar using arcpy?

enter image description here

  • There is some info at geonet.esri.com/thread/44365.
    – fatih_dur
    Commented Nov 25, 2016 at 3:12
  • 1
    @fatih_dur, not very promising, looks like ESRI was working on this 4 years ago and still nothing to show for it.
    – Fezter
    Commented Nov 25, 2016 at 3:29
  • Help page lists only common properties. E.g. property text is not shown and still I ised it a lot for text _ element.
    – FelixIP
    Commented Nov 25, 2016 at 4:22
  • Obviously @Fezter. I was thinking this is bound to the system locals and picks the right unit based on this but now I remember it gets Miles by default and then you need to pick metric one as to your preference.
    – fatih_dur
    Commented Nov 25, 2016 at 4:26
  • @FelixIP, I was getting hopeful there. text property doesn't work for MAP_SURROUND elements which is what the scalebar is. I get a runtime error when I try to access the text property on a scalebar
    – Fezter
    Commented Nov 25, 2016 at 4:38

1 Answer 1


As you don't know ArcObjects yet know Python, you can run this code to invoke ArcObjects from Python.

You would need to prepare the installation in order to be able to run this code. Refer to this blog post for detailed instructions. On GIS.SE, there are some great posts that helped me a lot to get started:

The code to run to update a single .mxd is below. You can use Python for loop to iterate over multiple .mxd files, wrapping the code below into a function first.

import sys
from comtypes.client import GetModule, CreateObject
from snippets102 import GetStandaloneModules, InitStandalone

esriCarto = GetModule(r"C:\Program Files (x86)\ArcGIS\Desktop10.4\com\esriCarto.olb")

# Running this code for the first time, you would need to import
#the “StandaloneModules”. Can comment out later.


#creating a map document object
mxdObject = CreateObject(esriCarto.MapDocument, interface=esriCarto.IMapDocument)

#accessing the map
IMap = mxdObject.ActiveView.FocusMap

#counting number of elements in the layout (i.e., map surrounds as Esri call those)
for i in xrange(0,IMap.MapSurroundCount):
    print IMap.MapSurround(i).name

#Alternating Scale Bar
#North Arrow
#Scale Text

#I know I need the element with certain name
scale_bar = [IMap.MapSurround(i) for i in xrange(0,IMap.MapSurroundCount)
             if IMap.MapSurround(i).name == 'Alternating Scale Bar'][0]

#accessing the properties if ScaleBar object - all the properties inside
#Alternating Scale Bar Properties window
IScaleBar = scale_bar.QueryInterface(esriCarto.IScaleBar)

print IScaleBar.UnitLabel
#u'Decimal Degrees'

#we want to change it to Meters
IScaleBar.UnitLabel = 'Meters'

#either save the same mxd, overwriting existing one; you cannot have it open in ArcMap

#or perhaps better to create copies

If you have troubles setting up comtypes and running Python accessing ArcObjects, do post a new question - there are some people here have done it and can help!

  • I suspected I would need to invoke ArcObjects.
    – Fezter
    Commented Nov 25, 2016 at 8:35
  • Working with ArcObjects can be super tedious as one needs to find all those interfaces and classes in huge diagrams. But as soon as you got yourself familiar with those and how to use the comptypes, it's fairly straightforward. You also get intellisense in your Python IDE because the properties are pulled for ArcObjects objects you work with in Python. Quite nice. ArcMap will be around for many years, so I think it's worth learning ArcObjects to be able to pull this kind of quick fixes when in need. Commented Nov 25, 2016 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.