Reputation: 1166
I try to get field name in VBA. All I get is the result text, or the complete code. I just want the field name.
I try field.Code
, give me : { MERGEFIELD NAME \* MERGEFORMAT }
or field.Result
, give me the merged result.
Sorry for french Word.
Upvotes: 3
Views: 5022
Reputation: 19067
It seems that there isn't any property which allows to get name
of MailMerge field. Therefore I could suggest the following workaround:
Sub qTest()
Dim tmpFieldCode As String
tmpFieldCode = ActiveDocument.MailMerge.Fields(1).Code
Dim tmpFieldName As String
tmpFieldName = Split(tmpFieldCode, " ")(2)
Debug.Print tmpFieldCode '>> MERGEFIELD Firma
Debug.Print tmpFieldName '>> Firma
End Sub
Upvotes: 3