MailMergeDataSource.EditRecord method (Publisher)
Changes one of the data fields in one of the records in the master data source (the combined mail-merge recipient list).
Syntax
expression.EditRecord (lRec, varField, Value)
expression A variable that represents a MailMergeDataSource object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
lRec | Required | Long | The ID of the record that you want to edit. |
varField | Required | Variant | The data field (column) that contains the value that you want to change. |
Value | Required | Variant | The value to be changed. |
Remarks
Use the EditRecord method to correct data source information that is in error, such as an outdated recipient address.
The EditRecord method does not make any changes to the individual data sources that together make up the master data source.
Example
The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the EditRecord method to change the value of a single column in a particular record in the master data source (the combined mail-merge recipient list).
Before running this macro, replace recordID
with the index number of the record in the data source that you want to edit, replace fieldname
with the name of the field (column) in the record that you want to edit, and replace value
with the new value that you want to set for the field.
Public Sub EditRecord_Example()
Dim pubMailMergeDataSource As Publisher.MailMergeDataSource
Set pubMailMergeDataSource = ThisDocument.MailMerge.DataSource
pubMailMergeDataSource.EditRecord recordID, "fieldname", "value"
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.