Summary
In VBA, default map units are set in the MxDocument object's NewDocument event using the MapUnits property of the IMap interface.
Procedure
- Start ArcMap.
- Open the Visual Basic Editor.
In ArcMap, select Tools > Macros > Visual Basic Editor.
- In the Visual Basic Project Explorer, select Normal > ArcMap Objects and double-click ThisDocument to open the code window.
- In the Normal.mxt ThisDocument (Code) window, select MxDocument as the object and NewDocument as the event.
- Add code to the MxDocument_NewDocument function to set the default map units to feet.
Code:
Dim pMxDoc as IMxDocument
Set pMxDoc = ThisDocument
Dim pMap as IMap
Set pMap = pMxDoc.FocusMap
pMap.MapUnits = esriFeet
Note:
The default units can be set to any of ESRI's measurement units. For a complete list, see the ArcObjects Developers Help under esriUnits Constants.
- Close the Visual Basic Editor.
- Back in the ArcMap window, double-click the dataframe to open the Dataframe Properties dialog box. Select the General tab. Note the map units.
- Close the dialog box and click the New Map button.
- Again, double-click the dataframe to open the Dataframe Properties dialog box. Select the General tab. Notice that the map units are now set to feet. Every time a new document is created, the map units are set to feet.
Note:
To remove this customization, either remove the code under the NewDocument event, or delete the normal.mxt.