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

MailMergeDataSource.DataFields Property (Publisher)

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

Returns a MailMergeDataFields collection that represents the fields in the specified data source.

Syntax

expression. DataFields

_expression_A variable that represents a MailMergeDataSource object.

Return Value

MailMergeDataFields

Example

This example displays the value of the value of the FirstName and LastName fields from the active record in the data source attached to the active publication.

Sub ShowNameForActiveRecord() 
 Dim mdfFirst As MailMergeDataField 
 Dim mdfLast As MailMergeDataField 

 With ActiveDocument.MailMerge.DataSource 
 Set mdfFirst = .DataFields.Item("FirstName") 
 Set mdfLast = .DataFields.Item("LastName") 
 MsgBox "The active record in the attached " &; _ 
 vbLf &; "data source is : " &; _ 
 mdfFirst.Value &; " " &; _ 
 mdfLast.Value 
 End With 
End Sub
© 2018 Microsoft