View Single Post
 
Old 04-12-2018, 11:35 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You could loop through the fieldnames collection and compare with your field name

Code:
Dim iFld As Integer
Dim bFound As Boolean
    For iFld = 1 To ActiveDocument.MailMerge.DataSource.FieldNames.Count
'Debug.Print ActiveDocument.MailMerge.DataSource.FieldNames(iFld)
        If UCase(ActiveDocument.MailMerge.DataSource.FieldNames(iFld)) = "MY FIELD" Then
            MsgBox "'My Field' exists"
            bFound = True
            Exit For
        End If
    Next iFld
    If Not bFound Then MsgBox "'My Field' does not exist"
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote