VBA - Frames


Frame Object

Represents a frame. The Frame object is a member of the Frames collection.



Frames Collection

The Frames collection includes all frames in a selection, range, or document.
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.



Creating Frames

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.


If you want the frame to "move with text" then the relative vertical position must be paragraph



Tables in the Frames collection

If you have a table in your document which has been positioned in a particular place on the page then this table will appear in the Frames collection
The text wrapping for this table will be "Around"



Text Wrapping

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.



Cut the offending shapes out of the document and paste them back into the document with their anchors at a new location, immediately below the heading paragraph.



If you work with Frames.
The TextRange property of the TextFrame object returns a range containing the text within the text frame.


Frame Property

Returns a Frame object that represents the frame formatting for the specified style or find-and-replace operation. Read-only.


This example creates a style with frame formatting and then applies the style to the first paragraph in the selection.


This example finds the first frame with wrap around formatting. If such a frame is found, a message is displayed on the status bar.




© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext