Item Property (Views Collection)

The Item property returns the specified CalendarView or TableView object from the Views collection. Read-only.

Syntax

objViewsColl.Item(index)

objViewsColl.Item(name)

index
A short integer ranging from 1 to objViewsColl.Count.
name
The display name of the CalendarView or TableView object to be selected from the Views collection.

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

Data Type

TableView object

Remarks

The Item property works like an accessor property.

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

The names of the predefined calendar views are "Daily" for a view with mode CdoModeCalendarDaily and "Weekly" for a view with mode CdoModeCalendarWeekly. The mode of the view is available from its Mode property.

You should give every view object a unique name. CDO does not enforce uniqueness, but if a collection has duplicate names, only the first one can be found by name.

Although the Item property itself is read-only, the CalendarView or TableView 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 view 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 objViewsColl.Count Step 1 
   strItemName(i) = objViewsColl.Item(i).Name 
   ' or = objViewsColl(i) since Item and Name are default properties 
   If 100 = i Then ' max size of string array 
      Exit Function 
   End If 
Next i