LockAnchor 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, _
    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