Etudes for Microsoft Word Programmers. Appendix.


Information on this page is from Microsoft MSDN http://msdn.microsoft.com.

Frame (Word 2003)

Object 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.

Using the Frame Object

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 allows text to wrap around the first frame in the active document.

ActiveDocument.Frames(1).TextWrap = True

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

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.

Frame Object Properties

Frame object properties are described in the following table.

Property Type Description
Borders Borders collection Returns Borders a collection that represents all the borders for the specified object.
Height Read/write Single Returns or sets the height of the specified object in points.
HeightRule Read/write
WdFrameSizeRule
Returns or sets the rule for determining the height of the specified frame.
HorizontalDistanceFromText Read/write Single Returns or sets the horizontal distance between a frame and the surrounding text, in points.
HorizontalPosition Read/write Single Returns or sets the horizontal distance between the edge of the frame and the item specified by the RelativeHorizontalPosition property. Can be a number that indicates a measurement in points, or can be one of the following WdFramePosition constants: wdFrameLeft, wdFrameRight, wdFrameCenter, wdFrameInside, or wdFrameOutside.
LockAnchor Read/write Boolean True if the specified frame is locked. The frame anchor indicates where the frame will appear in Normal view. You cannot reposition a locked frame anchor.
Range Range object Returns a Range object that represents the portion of a document that's contained in the specified frame object.
RelativeHorizontalPosition Read/write
WdRelativeHorizontal Position
Specifies to what the horizontal position of a frame, a shape, or a group of rows is relative.
RelativeVerticalPosition Read/write
WdRelativeVertical Position
Specifies to what the vertical position of a frame, a shape, or a group of rows is relative.
Shading Shading object Returns a Shading object that refers to the shading formatting for the specified object.
TextWrap Read/write Boolean True if document text wraps around the specified frame.
VerticalDistanceFromText Read/write Single Returns or sets the vertical distance (in points) between a frame and the surrounding text.
VerticalPosition Read/write Single Returns or sets the vertical distance between the edge of the frame and the item specified by the RelativeVerticalPosition property. Can be a number that indicates a measurement in points, or can be any valid WdFramePosition constant.
Width Read/write Long Returns or sets the width of the specified object, in points.
WidthRule Read/write
WdFrameSizeRule
Returns or sets the rule used to determine the width of a frame.

Enumeration WdFrameSizeRule

Enumeration WdFrameSizeRule defines the rule used to determine the height or the width of a frame.

Constant Value Description
wdFrameAtLeast 1 Sets the width to a value equal to or greater than the value specified by the Width or Height property.
wdFrameAuto 0 Sets the width according to the width of the item in the frame.
wdFrameExact 2 Sets the width to an exact value specified by the Width or Height property.

Enumeration WdFramePosition

Enumeration WdFramePosition defines the frame position.

Constant Value
wdFrameBottom -999997
wdFrameCenter -999995
wdFrameInside -999994
wdFrameLeft -999998
wdFrameOutside -999993
wdFrameRight -999996
wdFrameTop -999999

Enumeration WdRelativeHorizontalPosition

Enumeration WdRelativeHorizontalPosition specifies to what the horizontal position of a frame, a shape, or a group of rows is relative.

Constant Value
wdRelativeHorizontalPositionCharacter 3
wdRelativeHorizontalPositionColumn 2
wdRelativeHorizontalPositionMargin 0
wdRelativeHorizontalPositionPage 1

Enumeration WdRelativeVerticalPosition

Enumeration WdRelativeVerticalPosition specifies to what the vertical position of a frame, a shape, or a group of rows is relative.

Constant Value
wdRelativeVerticalPositionLine 3
wdRelativeVerticalPositionMargin 0
wdRelativeVerticalPositionPage 1
wdRelativeVerticalPositionParagraph 2

The difference between a text box and a frame

Some of the content in this topic may not be applicable to some languages.

Text boxes and frames are both containers for text that can be positioned on a page and sized.

If you are familiar with earlier versions of Microsoft Word, you used frames when you wanted to wrap text around a graphic. Now, you wrap text around a graphic of any size or shape without first inserting it in a text box or frame.

However, you must use a frame instead of a text box when you want to position text or graphics that contain certain items.

Use a text box when you want to do any of the following:

  • Make text flow from one part of a document to another part by linking the text boxes.
  • Format the text container by using the options on the Drawing toolbar. You can apply 3-D effects, shadows, border styles and colors, fills, and backgrounds.
  • Rotate and flip text boxes.
  • Change the orientation of text in a text box by using the Text Direction command (Format menu).
  • Group your text containers and change the alignment or distribution of them as a group.

Use frames when your text or graphics contain the following:

  • Comments, as indicated by comment marks.
  • Footnotes or endnotes, as indicated by note reference marks.
  • Certain fields, including AUTONUM, AUTONUMLGL, AUTONUMOUT used for numbering lists and paragraphs in legal documents and outlines TC (Table of Contents Entry), TOC (Table of Contents), RD (Referenced Document), XE (Index Entry), TA (Table of Authorities Entry), and TOA (Table of Authority) fields.

When you open a document that contains frames from a previous version of Word, Word keeps the frames. When you select a frame, the Frame command appears on the Format menu.

"Frame" Dialog

Dialog "Add/modify Style" has a "Format" button in the bottom left. "Format" menu has "Frame" item which displays the following "Frame" dialog.

 


Etudes for Microsoft Word Programmers. Appendix. Object Frame.


Unless otherwise noted, all materials on this site are
2000-2009 Evgeny Akhundzhanov, All Rights Reserved Worldwide
Microsoft is in no way affiliated with, nor offers endorsement of, this site.
www.transcriber.ru | E-mail the Author