MailMergeMappedDataField.DataFieldName プロパティ (Publisher)
マップされたデータ フィールドがマップされる差し込み印刷データ ソース内のフィールドの名前を表す 文字列型 (String) の値を取得または設定します。 指定されたデータ フィールドがマップしたデータ フィールドにマップされていない場合は、空の文字列が返されます。 値の取得と設定が可能です。
構文
式。DataFieldName
式MailMergeMappedDataField オブジェクトを表す変数。
戻り値
String
例
次の使用例は、現在の文書の新しいページに表を作成し、使用可能なマップしたデータ フィールドと、それらのフィールドがマップしているデータ ソースのフィールドを一覧表示します。 この使用例では、現在の文書は差し込み印刷文書であり、データ ソースのフィールドには対応するマップしたデータ フィールドがあると仮定します。
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 のサポートおよびフィードバックを参照してください。
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示