Platform SDK: CDO 1.2.1 |
The Item property returns the specified Format object from the Formats collection. Read-only.
objFormatsColl.Item(index)
objFormatsColl.Item(name)
objFormatsColl.Item(propTag)
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.
Format object
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.
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