The following code aligns the top edge of each text box to the top of the paragraph to which the text box is anchored:
Code:
Sub Textbox() ' 06/15/2022
Application.ScreenUpdating = False
Dim i As Integer
Dim sh As ShapeRange
Set sh = ActiveDocument.Range.ShapeRange
For i = 1 To ActiveDocument.Shapes.Count
If sh(i).Type = 17 And sh(i).AutoShapeType = 1 Then
sh(i).Select
With Selection.ShapeRange
.RelativeHorizontalPosition = wdRelativeHorizontalPositionLeftMarginArea
' Align shape relative to the paragraph to which it's anchored:
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
' Adjust alignment of the top of the shape to more precisely
' align it with the top of the paragraph; revise as necessary:
.Top = CentimetersToPoints(0.18)
.RelativeHorizontalSize = wdRelativeHorizontalSizeMargin
.RelativeVerticalSize = wdRelativeVerticalSizeMargin
.Left = CentimetersToPoints(1.7)
.LeftRelative = wdShapePositionRelativeNone
.TopRelative = wdShapePositionRelativeNone
.WidthRelative = wdShapeSizeRelativeNone
.HeightRelative = wdShapeSizeRelativeNone
.LockAnchor = True
.TextFrame.WordWrap = True
End With
End If
Next
Application.ScreenUpdating = True
End Sub