HorizontalDistanceFromText Property Example

This example adds a frame around the selection and sets the horizontal distance between the frame and the text to 12 points.

Set myFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)
myFrame.HorizontalDistanceFromText = 12

This example adds a frame around the first paragraph and sets several properties of the frame.

Set aFrame = ActiveDocument.Frames.Add _
    (Range:=ActiveDocument.Paragraphs(1).Range)
With aFrame
    .HorizontalDistanceFromText = InchesToPoints(0.25)
    .VerticalDistanceFromText = InchesToPoints(0.25)
    .HeightRule = wdFrameAuto
    .WidthRule = wdFrameAuto
    .Borders.Enable = False
End With