View Merged Fields

J

Jimbob

I have a Word template where I want to display merged data before updating.
Currently I'm using:
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
but this is only good if the user opens the template and doesn't toggle the
fields codes themself.
Please can someone say what would be the code to ensure the merged data is
display rather than the codes, regardless of how they have saved the template?

Many Thanks
BTW, I'm using Word 2003.
 
D

Doug Robbins - Word MVP

If you were to look at the Help information for the ViewMailMergeFieldCodes,
you would find:

MailMerge.ViewMailMergeFieldCodes Property
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.
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



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top