MailMerge.ViewMailMergeFieldCodes property (Word)
True if merge field names are displayed in a mail merge main document. False if information from the current record is displayed. Read/write Long.
Syntax
expression. ViewMailMergeFieldCodes
expression An expression that returns a 'MailMerge' object.
Remarks
If the active document isn't a mail merge main document, this property causes an error. To view merge field names or their results, set the ShowFieldCodes property to False.
Example
This example displays the mail merge fields in Main.doc.
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
With Documents("Main.doc")
.Activate
.MailMerge.ViewMailMergeFieldCodes = True
End With
If the active document is set up for a mail merge operation, this example displays the current record information in the main document.
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndSourceAndHeader Or _
myMerge.State = wdMainAndDataSource Then
myMerge.ViewMailMergeFieldCodes = False
End If
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for