Hi Jason,
You can get the names of the mergefields in the mailmerge main document by
using the following:
Dim mf As Field, mfname As Range
Dim i As Integer, j As Integer
counter = 0
For Each mf In ActiveDocument.Fields
If mf.Type = wdFieldMergeField Then
Set mfname = mf.Code
i = InStr(mfname, Chr(34))
j = InStr(Mid(mfname, i + 1), Chr(34))
mfname.End = mfname.Start + i + j - 1
mfname.Start = mfname.Start + i
MsgBox mfname
End If
Next mf
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
> I am using VB to automate Word 2002 and am trying to delete invalid merge
> fields before I run a mail merge. I am enumerating the fields in the main
[quoted text clipped - 5 lines]
>
> Jason
Jason - 29 Oct 2003 12:06 GMT
Perfect...thanks.
> Hi Jason,
>
[quoted text clipped - 32 lines]
> >
> > Jason