|Publisher Developer Reference|
Version Added: Publisher 2007
expression.ExportRecipientList(Filename, FileType, IncludedOnly)
expression A variable that represents a MailMerge object.
|Filename||Required||String||The name of the file that will contain the list of recipients.|
|FileType||Optional||PbRecipientListFileType||The type of file to save. See Remarks for possible values.|
|IncludedOnly||Optional||Boolean||Whether to restrict entries in the recipient list to specific recipients.|
Possible values for the FileType parameter include the following constants from the PbRecipientListFileType enumeration:
Save as comma-delimited CSV file.
Save as Microsoft Office Access MDB file.
The ExportRecipientList method corresponds to the Export recipient list to new file command in the E-mail Merge and Mail Merge task panes in the Microsoft Office 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 MailMerge.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 Microsoft Windows Vista. You must have permission to save files in the folder you designate.
|Visual Basic for Applications|