Class Frames (Word VBA)

Word Object Model Reference To use a Frames class variable it first needs to be instantiated, for example


Dim frms as Frames
Set frms = ActiveDocument.Frames

For Each

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


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

Add

Returns a Frame object that represents a new frame added to a range, selection, or document.

Add (Range)

Range: The range that you want the frame to surround.


ActiveDocument.Frames.Add Range:=Selection.Range

Count

Returns a Long that represents the number of frames in the collection.


Dim lngCount As Long
lngCount = ActiveDocument.Frames.Count

Delete

Deletes the specified Frames collection.


ActiveDocument.Frames.Delete

Item

Returns an individual Frames object in a collection.

Item (Index)

Index: The individual object to be returned.


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