English

How To: Make a layout fit a page size that has been changed

Summary

After changing the page size the objects in the layout doesn't match the extent of the page. This script below will automatically make the object in the layout match the page size.

Procedure

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.


  2. Paste the following code into the script window:

    Code:
    thelay = av.getactivedoc
    thelaydisp = thelay.getdisplay
    thelaydisp.setunits(#units_linear_inches)
    theglist = thelay.getgraphics
    theglist.selectall
    theglist.groupselected
    thetest = thelaydisp.returnmarginextent
    thetesta = thetest.clone.scale(0.985)
    theglist.setselectedextent(thetesta)
    theglist.ungroupselected
    thesca = theglist.Findbyclass(scalebarframe)
    thesca.setintervals(2)
    thesca.setdivisions(1)
    thelay.invalidate

  3. Attach the script to a button on the Layout GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog, select Layout under Type dropdown.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Enter the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see 'Customize dialog box' in ArcView Help.

  4. Open the layout and click the new button.