Upravit

Sdílet prostřednictvím


Shape.LockAnchor property (Word)

True if the anchor of a Shape object is locked to the anchoring range. Read/write Long.

Syntax

expression. LockAnchor

expression Required. A variable that represents a Shape object.

Remarks

When a shape has a locked anchor, you cannot move the shape's anchor by dragging it. The anchor does not move as the shape is moved. 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

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

See also

Shape Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.