Table of contents
TOC
Collapse the table of content
Expand the table of content

MailMerge.CreateShortcut Method (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Creates a shortcut to the file that contains the list of recipients or products for a mail merge publication.

Syntax

expression. CreateShortcut( Filename)

_expression_A variable that represents a MailMerge object.

Parameters

NameRequired/OptionalData TypeDescription
FilenameRequiredStringName of the mailing list or product list file for which the shortcut should be created.

Remarks

The CreateShortcut method corresponds to the Save a shortcut to recipient list command in the Mail Merge and E-mail Merge task panes, and the Save a shortcut to product list command in the Catalog Merge task pane in the Microsoft Publisher user interface.

Mailing list recipient files have the .ols extension (for Microsoft Office List Shortcut).

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the CreateShortcut method to create a shortcut to a mail-merge recipient list. 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.

Public Sub CreateShortcut_Example() 

 Dim pubMailMerge As Publisher.MailMerge 
 Set pubMailMerge = ThisDocument.MailMerge 

 pubMailMerge.CreateShortcut ("C:\Users\username\Documents\My Data Sources\MyRecipientList") 

End Sub
© 2018 Microsoft