Platform SDK: CDO for Windows 2000

Delete Method

The Delete method removes the specified BodyPart object from the collection.

[Visual Basic]
Sub Delete(Item as Variant)
[C++]
HRESULT Delete( VARIANT Item);
[IDL]
HRESULT Delete([in] VARIANT Item );

Parameters

Item
Either the ordinal index or the IBodyPart interface on the object that you are removing from the collection.

Remarks

You can delete the object by specifying its position in the collection or by passing the IBodyPart interface to the Delete method.

Example

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg as New CDO.Message
Dim iBp as IBodyPart
Dim iBps as IBodyParts
Set iBps = iMsg.BodyPart.BodyParts
Set iBp = iBps.Add
... '  add more body parts
iBps.Delete iBp  ' delete this specific object
iBps.Delete 2    ' delete object # 2