Platform SDK: CDO 1.2.1

Item Property (Formats Collection)

The Item property returns the specified Format object from the Formats collection. Read-only.

Syntax

objFormatsColl.Item(index)

objFormatsColl.Item(name)

objFormatsColl.Item(propTag)

index
Integer. Value must be greater than 0 and less than or equal to 65,535 (&HFFFF). Specifies the index within the Formats collection.
name
String. The display name of the Format object to be selected from the collection.
propTag
Long. Value must be greater than or equal to 65,536 (&H10000). Specifies the 32-bit property tag of the renderable property corresponding to a format in the collection. The renderable property is indicated in the Format object’s Property property.

The Item property is the default property of a Formats collection, meaning that objFormatsColl(index) is syntactically equivalent to objFormatsColl.Item(index) in Microsoft® Visual Basic® code.

Data Type

Format object

Remarks

The Item property works like an accessor property.

If the specified Format object is not found in the collection, the Item property returns Nothing.

If a format represents a custom property, you cannot select the format by the property name, because the name parameter specifies the name of the format itself. In such a case, you must ascertain the property tag for the property and supply it in the propTag parameter. You can obtain the property tag of a custom property from the ID property of the Field object being used to access the custom property.

Although the Item property itself is read-only, the Format object it returns can be accessed in the normal manner, and its properties retain their respective read/write or read-only accessibility.

Example

This code fragment shows the Count and Item properties working together:

' Put all format names in a collection into a string array 
Dim strItemName(100) as String 
Dim i As Integer ' loop counter 
' error handling omitted from this fragment ... 
For i = 1 To objFormatsColl.Count Step 1 
    strItemName(i) = objFormatsColl.Item(i).Name 
    ' or = objFormatsColl(i) since Item and Name are default properties 
    If 100 = i Then ' max size of string array 
        Exit Function 
    End If 
Next i