I need help to identify the data frame (from several data frames) that corresponds to a scale bar in ArcMap?
The suggestion by @MichaelMiles-Stimson is a good one.
Alternatively, you could type some code into the Python window of ArcMap:
mapDoc = arcpy.mapping.MapDocument("CURRENT") scaleBar = arcpy.mapping.ListLayoutElements(mapDoc,"MAPSURROUND_ELEMENT") print scaleBar.parentDataFrameName
If your scale bar is the only Map Surround Element in your map then the above will work.
If you have multiple Map Surround Elements then go to the Size & Position tab of the Properties for the Scale Bar and give it a name - in the graphic below I have let it stay as the default of "Scale Line".
Now you will be able to isolate that one Map Surround Element (or at least the first Map Surround Element named "Scale Line") by using:
scaleBar = arcpy.mapping.ListLayoutElements(mapDoc,"MAPSURROUND_ELEMENT","Scale Line")
In the table of contents window, when you activate a certain data frame, anything that you do thereafter will correspond to that specific data frame contents. If you add anything it will belong to the activated frame. This might help you in knowing to which data frame will your scale bar belong to when you add. If you have few data frames you could remove the scale bars then add them again with this in mind.