MailMergeDataSource.MappedDataFields 屬性 (Publisher)
會傳回代表 Microsoft Publisher 中可用的對應資料欄位的 MailMergeMappedDataFields 物件。
語法
運算式。MappedDataFields
表達 代表 MailMergeDataSource 物件的 變數。
傳回值
MailMergeMappedDataFields
範例
本範例會將目前的出版物的新頁面上建立表格和列出 Publisher 中可用的對應的資料欄位以及它們所對應的資料來源中的欄位。 本範例假設目前出版物是一個合併印刷出版物,而且資料來源欄位有相對的對應資料欄位。
Sub MappedFields()
Dim intCount As Integer
Dim intRows As Integer
Dim docPub As Document
Dim pagNew As Page
Dim shpTable As Shape
Dim tblTable As Table
Dim rowTable As Row
On Error Resume Next
Set docPub = ThisDocument
Set pagNew = ThisDocument.Pages.Add(Count:=1, After:=1)
intRows = docPub.MailMerge.DataSource.MappedDataFields.Count + 1
'Creates new table with a heading row
Set shpTable = pagNew.Shapes.AddTable(NumRows:=intRows, _
numColumns:=2, Left:=100, Top:=100, Width:=400, Height:=12)
Set tblTable = shpTable.Table
With tblTable.Rows(1)
With .Cells(1).Text
.Text = "Mapped Data Field"
.Font.Bold = msoTrue
End With
With .Cells(2).Text
.Text = "Data Source Field"
.Font.Bold = msoTrue
End With
End With
With docPub.MailMerge.DataSource
For intCount = 2 To intRows - 1
'Inserts mapped data field name and the
'corresponding data source field name
tblTable.Rows(intCount - 1).Cells(1).Text _
.Text = .MappedDataFields(Index:=intCount).Name
tblTable.Rows(intCount - 1).Cells(2).Text _
.Text = .MappedDataFields(Index:=intCount).DataFieldName
Next
End With
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。