Class Frame (Word VBA)

The class Frame represents a frame. The Frame object is a member of the Frames collection. The Frames collection includes all frames in a selection, range, or document.

The classes Find, Replacement and Style. give access to class Frame

To use a Frame class variable it first needs to be instantiated, for example

Dim frm as Frame
Set frm = ActiveDocument.Frames(Index:=1)

The following procedures can be used to set variables of type Frame: Find.Frame, Frames.Add, Frames.Item, Replacement.Frame and Style.Frame.

For Each

Here is an example of processing the Frame items in a collection.

Dim frm As Frame
For Each frm In ActiveDocument.Frames
	
Next frm

Methods

Copy - Copies the specified frame to the Clipboard.

Cut - Removes the specified frame from the document and places it on the Clipboard.

Delete - Deletes the specified frame.

Select - Selects the specified object.

Properties

Borders returns a Borders collection that represents all the borders for the specified frame.

Height returns or sets a Single that represents the height (in points) of the specified frame.

HeightRule returns or sets a WdFrameSizeRule that represents the rule for determining the height of the specified frame.

HorizontalDistanceFromText returns or sets the horizontal distance between a frame and the surrounding text, in points.

HorizontalPosition returns or sets the horizontal distance between the edge of the frame and the item specified by the RelativeHorizontalPosition property.

LockAnchor true if the specified frame is locked.

Range returns a Range object that represents the portion of a document that's contained within the frame.

RelativeHorizontalPosition specifies the relative horizontal position of a frame.

RelativeVerticalPosition specifies the relative vertical position of a frame.

Shading returns a Shading object that refers to the shading formatting for the specified object.

TextWrap true if document text wraps around the specified frame.

VerticalDistanceFromText returns or sets the vertical distance (in points) between a frame and the surrounding text.

VerticalPosition returns or sets the vertical distance between the edge of the frame and the item specified by the RelativeVerticalPosition property.

Width returns or sets the width (in points) of the frame, in points.

WidthRule returns or sets the rule used to determine the width of a frame.

Borders - A collection of Border objects that represent the borders of an object.

Range - Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.

Shading - Contains shading attributes for an object.