LockAnchor Property

Applies To

Frame object, Shape object, ShapeRange collection object.

Description

Frame object: True if the specified frame is locked. The frame anchor indicates where the frame will appear in Normal view. You cannot reposition a locked frame anchor. Read/write Boolean.

Shape or ShapeRange object: True if the specified Shape or ShapeRange object's anchor is locked to the anchoring range. When a shape has a locked anchor, you cannot move the shape's anchor by dragging it (the anchor doesn't move as the shape is moved). Read/write Boolean.

Remarks

A Shape objects is anchored to a range of text, but you can position it anywhere on the page. The shape is anchored to the beginning of the first paragraph that contains the anchoring range. A shape will always remain on the same page as its anchor.

See Also

Anchor property, RelativeHorizontalPosition property, RelativeVerticalPosition property, Shape object, ShowObjectAnchors property.

Example

This example locks the anchor of the first frame in section two in the active document.

Set myRange = ActiveDocument.Sections(2).Range
If TypeName(myRange) <> "Nothing" And myRange.Frames.Count > 0 Then
    myRange.Frames(1).LockAnchor = True
End If
This example creates a new document, adds a shape to it, and then locks the shape's anchor.

Set myDoc = Documents.Add
Set myShape = myDoc.Shapes.AddShape(msoShapeBalloon, 0, 0, 140, 70)
myShape.LockAnchor = True
ActiveWindow.View.ShowObjectAnchors = True
This example returns a message that states the lock status for each shape in the active document.

For each s in ActiveDocument.Shapes
    Msgbox "Shape " & s.Count & " is locked - " & s.LockAnchor
Next s