|Publisher Developer Reference|
Version Added: Publisher 2007
expression A variable that represents a MailMergeDataField object.
|bstrValue||Optional||String||The name of the recipient field that the data source column is to be mapped to.|
This method works only if the parent MailMergeDataField object has not already been mapped to a recipient field. You can use the IsMapped property of the MailMergeDataField object to determine if the object has already been mapped.
If you do not pass a value for the optional bstrValue parameter, Microsoft Office Publisher assumes that the field to be mapped has the same name as the recipient field in the master data source to which it is mapped.
If you pass the name of a field that does not exist, Publisher returns an error.
|To add a field, use the AddToRecipientFields method.|
The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the MapToRecipientField method to map a data field (column) in a particular data source to a field in the master data source (combined recipient list) for the publication.
Before running this macro, replace datasourceindex with the index number of a valid data source in the data source collection of the active document, replace fieldname with the name of the field in the data source that you want to map to a recipient field, and replace recipientfieldname with the name of the recipient field.
See the Item method topic for an example of how you can use the Name property of the DataSource object to determine the index number of the data source you want.
|Visual Basic for Applications|