Share via


Attachments.ClearAll Method (Publisher)

Clears (deletes) all the Attachment objects in the parent Attachments collection of an e-mail merge message.

Version Information

Version Added: Publisher 2007

Syntax

expression .ClearAll

expression A variable that represents an Attachments collection.

Remarks

To clear an individual attachment, use the Delete method of the specific Attachment object

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to clear all the attachment to the message in an e-mail merge. The code prints the number of current attachments to the message in the Immediate window and then deletes all of the Attachment objects in the collection.

Public Sub ClearAll_Example() 
 
 Dim pubAttachments As Publisher.Attachments 
 
 Dim pubMailMerge As Publisher.MailMerge 
 Dim pubEmailMergeEnvelope As Publisher.EmailMergeEnvelope 
 
 Set pubMailMerge = ThisDocument.MailMerge 
 Set pubEmailMergeEnvelope = pubMailMerge.EmailMergeEnvelope 
 Set pubAttachments = pubEmailMergeEnvelope.Attachemts 
 
 Debug.Print pubAttachments.Count 
 pubAttachments.ClearAll 
 
End Sub

See Also

Concepts

Attachments Object Members

Attachments Collection