Skip to content

Latest commit

 

History

History
55 lines (33 loc) · 1.51 KB

Publisher.Attachments.ClearAll.md

File metadata and controls

55 lines (33 loc) · 1.51 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Attachments.ClearAll method (Publisher)
vbapb10.chm569350
vbapb10.chm569350
Publisher.Attachments.ClearAll
ae4e4c60-56cb-f97b-06f4-bd0d2abac4ee
06/05/2019
medium

Attachments.ClearAll method (Publisher)

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

Syntax

expression.ClearAll

expression A variable that represents an Attachments object.

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 attachments to the message in an email 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.Attachments 
 
 Debug.Print pubAttachments.Count 
 pubAttachments.ClearAll 
 
End Sub

[!includeSupport and feedback]