PROBLEM

The North arrow and other graphic elements shift positions in the layout

Last Published: April 25, 2020

Description



** This issue has been resolved in ArcGIS 9.0. **



When switching between the data view and layout view, or when saving an MXD and reopening it, the North arrow, scale bar and other graphic elements in the layout have shifted positions.

Cause

This is a known issue with ArcGIS 8.3 and earlier versions.

Solution or Workaround

Run the script SaveElementGeometry to save all the current positions, then the RestoreElementGeometry script to move the elements back to their saved positions.

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

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

  3. Expand Project.mxt in the Project Explorer window, and select ArcMap Objects > ThisDocument. Right-click and select View Code.
    [O-Image] Visual Basic Project  Explorer
    Note:
    Code in the Project's ThisDocument code module only runs in the current map document. To store the code in all the map documents, open the Normal.mxt ThisDocument code module instead.

  4. Paste the following code into the code module.
    Code:
    Option Explicit
    Sub SaveElementGeometry()
    ' set each element's customproperty to its current geometry
    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument

    Dim pGC As IGraphicsContainer
    Set pGC = pMxDoc.PageLayout
    pGC.Reset

    Dim pElement As IElement, pElementProps As IElementProperties
    Set pElement = pGC.Next
    Do While Not pElement Is Nothing
    Set pElementProps = pElement
    pElementProps.CustomProperty = pElement.Geometry
    Set pElement = pGC.Next
    Loop
    End Sub

    Sub RestoreElementGeometry()
    ' sets each element's geometry to its customproperty
    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument

    Dim pGC As IGraphicsContainer
    Set pGC = pMxDoc.PageLayout
    pGC.Reset

    Dim pElement As IElement, pElementProps As IElementProperties
    Set pElement = pGC.Next
    Do While Not pElement Is Nothing
    Set pElementProps = pElement
    If Not IsNull(pElementProps.CustomProperty) Then
    pElement.Geometry = pElementProps.CustomProperty
    End If
    Set pElement = pGC.Next
    Loop
    Dim pAV As IActiveView
    Set pAV = pMxDoc.PageLayout
    pAV.Refresh
    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:000006529

Software:
  • 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