Article ID: 224909
Article Last Modified on 3/19/2004
APPLIES TO
- Microsoft Outlook 2000 Standard Edition
This article was previously published under Q224909
SYMPTOMS
You use the Remove method to programmatically remove an attachment from an item, but the attachment is not actually deleted from the Attachments collection.
CAUSE
The Remove method was not fully implemented in the Outlook object model.
WORKAROUND
Instead of using the Remove method, use the Delete method of the Attachment object.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce the Problem
- Open an existing item that has one or more attachments.
Run the following Outlook Visual Basic for Applications code:
Sub RemoveAttachments() Dim itm As Object Dim atts As Attachments Dim i As Integer Set itm = ActiveInspector.CurrentItem Set atts = itm.Attachments While atts.Count > 0 atts.Remove 1 Wend itm.Save Set atts = Nothing Set itm = Nothing End Sub
- Note that the attachments appear to be deleted.
- Close, and then reopen the item.
Result: The attachments are still there.
REFERENCES
For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:
146636 OL2000: Questions About Custom Forms and Outlook Solutions
Additional query words: OL2K OutSol OutSol2000 vbscript
Keywords: kbbug kbpending kbdswnet2003swept KB224909