MailMergeDataSource.DataFields 屬性 (Publisher)MailMergeDataSource.DataFields property (Publisher)

會傳回代表指定資料來源中之欄位的 MailMergeDataFields 集合。Returns a MailMergeDataFields collection that represents the fields in the specified data source.



_運算式_代表**MailMergeDataSource** 物件的變數。expression A variable that represents a MailMergeDataSource object.

傳回值Return value



本範例會顯示貼附至使用中出版物的資料來源中的現用記錄的 FirstName 和 LastName 欄位的值。This example displays 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 & " " & _ 
 End With 
End Sub

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.