Frames Collection Object

Microsoft Word Visual Basic

Frames Collection Object

         
Multiple objects Frames (Frame)
Multiple objects

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

Using the Frames Collection

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

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.

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.

ActiveDocument.Sections(1).Range.Frames(1).TextWrap = True

Remarks

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.