Share via


Frames Collection Object

Word Developer Reference

A collection of Frame objects in a selection, range, or document.

Remarks

Use the Frames property to return the Frames collection. The following example removes borders from all frames in the active document.

Visual Basic for Applications
  For Each aFrame In ActiveDocument.Frames
    aFrame.Borders.Enable = False
Next aFrame

Use the Add method to add a frame around a range. The following example adds a frame around the first paragraph in the active document.

Visual Basic for Applications
  ActiveDocument.Frames.Add _
    Range:=ActiveDocument.Paragraphs(1).Range

Use Frames(Index), where Index is the index number, to return a single Frame object. The index number represents the position of the frame in the selection, range, or document. The following example causes text to wrap around the first frame in the first section of the active document.

Visual Basic for Applications
  ActiveDocument.Sections(1).Range.Frames(1).TextWrap = True

You can wrap text around Shape or ShapeRange objects by using the WrapFormat property. You can position a Shape or ShapeRange object by using the Top and Left properties.

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See Also