Index Property (Recipient Object)

The Index property returns the index number of the Recipient object within the Recipients collection. Read-only.

Syntax

objRecipient.Index

Data Type

Long

Remarks

The Index property indicates this object's position within the parent Recipients collection. It can be saved and used later with the collection's Item property to reselect the same recipient in the collection.

The first object in the collection has an Index value of 1.

An index value should not be considered a static value that remains constant for the duration of a session. It can be affected when other recipients are added and deleted. The index value is changed following an update to the Message object to which the Recipients collection belongs.

Example

Dim curIndex, savIndex as Integer ' variables to work with Index 
' select next recipient from collection 
If curIndex >= objRecipColl.Count Then 
    curIndex = objRecipColl.Count 
    MsgBox "Already at end of recipient list" 
    Exit Function 
End If 
' index is < count; can be incremented by 1 
curIndex = curIndex + 1 
Set objOneRecip = objRecipColl.Item(curIndex) 
' could be objRecipColl(curIndex) since Item is default property 
' save index for later use; but remember it could change if deletions 
If objOneRecip Is Nothing Then 
    MsgBox "Could not select next recipient" 
    Exit Function 
End If 
savIndex = objOneRecip.Index 
MsgBox "Recipient index = " & savIndex