MailMerge.ExportRecipientList method (Publisher)

Exports the list of mail-merge recipients to a Microsoft Office Access (.mdb) file or to a comma-delimited text (.csv) file.


expression.ExportRecipientList (FileName, FileType, IncludedOnly)

expression A variable that represents a MailMerge object.


Name Required/Optional Data type Description
FileName Required String The name of the file that will contain the list of recipients.
FileType Optional PbRecipientListFileType The type of file to save. Can be one of the PbRecipientListFileType constants.
IncludedOnly Optional Boolean Whether to restrict entries in the recipient list to specific recipients.


The ExportRecipientList method corresponds to the Export recipient list to new file command in the Email Merge and Mail Merge task panes in the Microsoft Publisher user interface.


The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ExportRecipientList method to export the list of mail-merge recipients to an Access database file. Before running this macro, ensure that the active document is connected to a data source. If the active document is not already connected to a data source, you can use the OpenDataSource method to make the connection.

Also, before running the code, replace username in the folder path to the saved file with the name of a valid user on your computer, or replace the folder path and file name with a path and file name of your choice.

Note that the folder path used in this example is typical of folder paths in Windows. You must have permission to save files in the folder that you designate.

Public Sub ExportRecipientList_Example() 
 Dim pubMailMerge As Publisher.MailMerge 
 Set pubMailMerge = ThisDocument.MailMerge 
 pubMailMerge.ExportRecipientList "C:\Users\username\Documents\My Data Sources\MyAddressList", pbAsMdbFile, True 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.