ActiveRecord Property 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 numerical position of the active data record from Main2.doc.

If Documents("Main2.doc").MailMerge.State = _
        wdMainAndDataSource Or _
        wdMainAndSourceAndHeader Then
    num = Documents("Main2.doc").MailMerge _
        .DataSource.ActiveRecord
End If