Index Property (AddressList Object)

The Index property returns the index number for the AddressList object within the AddressLists collection. Read-only.

Syntax

objAddressList.Index

Data Type

Long

Remarks

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

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

The Index property does not correspond to a MAPI property and cannot be rendered into HTML hypertext by the CDO Rendering Library.

Example

Function AddressListsGetByIndex() 
Dim rqIndex As Long ' requested index value within collection 
Dim svIndex As Long ' saved index value within collection 
Dim objOneAddressList As AddressList ' requested address list 
' set error handler here 
If objAddressListsColl Is Nothing Then 
    MsgBox "Must select a valid AddressLists collection" 
    Exit Function 
End If 
If 0 = objAddressListsColl.Count Then 
    MsgBox "Must select collection with 1 or more address lists" 
    Exit Function 
End If 
' get rqIndex by passed parameter or by prompting ... 
Set objOneAddressList = objAddressListsColl.Item(rqIndex) 
If objOneAddressList Is Nothing Then 
    MsgBox "AddressList could not be selected" 
    Exit Function 
End If 
MsgBox "Selected address list: " & objOneAddressList.Name 
svIndex = objOneAddressList.Index ' save index for later 
' get same AddressList object later ... 
Set objOneAddressList = objAddressListsColl.Item(svIndex) 
If objOneAddressList Is Nothing Then 
    MsgBox "Error: could not reselect the address list" 
Else 
    MsgBox "Reselected address list (" & svIndex & _ 
           ") using saved index: " & objOneAddressList.Name 
End If 
Exit Function