Platform SDK: CDO 1.2.1 |
The Count property returns the number of Attachment objects in the collection. Read-only.
collAttachments.Count
Long
This code fragment stores in an array the names of all Attachment objects in the collection. It shows the Count and Item properties working together.
' from the sample function, TstDrv_Util_SmallCollectionCount ' collAttachments is an Attachments collection x = Util_SmallCollectionCount(collAttachments) Function Util_SmallCollectionCount(objColl As Object) Dim strItemName(100) As String ' Names of objects in collection Dim i As Integer ' loop counter On Error GoTo error_amsmtp If objColl Is Nothing Then MsgBox "Must supply a valid collection object as a parameter" Exit Function End If If 0 = objColl.Count Then MsgBox "No messages in the collection" Exit Function End If For i = 1 To objColl.Count Step 1 strItemName(i) = objColl.Item(i).Name If 100 = i Then ' max size of string array Exit Function End If Next i ' error handling here... End Function