LockAnchor Property

Microsoft Word Visual Basic

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.

expression.LockAnchor

expression    Required. An expression that returns a Frame object.

ShowLockAnchor property as it applies to the Shape and ShapeRange objects.

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 Long.

expression.LockAnchor

expression    Required. An expression that returns one of the above objects.

Remarks

A Shape object 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.

Example

ShowAs it applies to the Frame object.

This example locks the anchor of the first frame in section two of 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
				

ShowAs it applies to the Shape and ShapeRange objects.

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, _
    100, 100, 140, 70)
myShape.LockAnchor = True
ActiveDocument.ActiveWindow.View.ShowObjectAnchors = True
				

This example returns a message that states the lock status for each shape in the active document.

For x = 1 to ActiveDocument.Shapes.Count
    Msgbox "Shape " & x & " is locked - " _
        & ActiveDocument.Shapes(x).LockAnchor
Next x