MailMergeDataSource.ActiveRecord Property (Word)

Returns or sets the active mail merge record. Can be either a valid record number in the query result or one of the WdMailMergeActiveRecord constants.

Syntax

expression .ActiveRecord

expression A variable that represents a MailMergeDataSource object.

Remarks

The active record number is the position of the record in the query result produced by the current query options; as such, this number isn't necessarily the position of the record in the data source.

Example

This example hides the mail merge field codes in the active document so that the merge data is visible in the main document. The active record is then advanced to the next record in the data source.

If ActiveDocument.MailMerge.MainDocumentType <> _ 
 wdNotAMergeDocument Then 
 With ActiveDocument.MailMerge 
 .ViewMailMergeFieldCodes = False 
 .DataSource.ActiveRecord = wdNextRecord 
 End With 
End If

This example returns the numeric position of the active record from Main2.doc.

Dim intRecordNumber as Integer 
 
If Documents("Main2.doc").MailMerge.State = _ 
 wdMainAndDataSource Or _ 
 wdMainAndSourceAndHeader Then 
 intRecordNumber = Documents("Main2.doc").MailMerge _ 
 .DataSource.ActiveRecord 
End If

See Also

Concepts

MailMergeDataSource Object Members

MailMergeDataSource Object