Remove Method Example

This Visual Basic for Applications example uses the Remove method to remove all attachments from a forwarded message before sending it on to John Y. Chen.

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem.Forward
Set myAttachments = myItem.Attachments
While myAttachments.Count > 0
    myAttachments.Remove 1
Wend
myItem.Recipients.Add "John Y. Chen"
myItem.Send

If you use VBScript, you do not create the Application object. This example shows how to perform the same task using VBScript.

Set myItem = Application.ActiveInspector.CurrentItem.Forward
Set myAttachments = myItem.Attachments
While myAttachments.Count > 0
    myAttachments.Remove 1
Wend
myItem.Recipients.Add "John Y. Chen"
myItem.Send