MailMergeFields.AddNextIf Method

Adds a NEXTIF field to a mail merge main document. Returns a MailMergeField object.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)


Function AddNextIf ( _
    Range As Range, _
    MergeField As String, _
    Comparison As WdMailMergeComparison, _
    ByRef CompareTo As Object _
) As MailMergeField
Dim instance As MailMergeFields
Dim Range As Range
Dim MergeField As String
Dim Comparison As WdMailMergeComparison
Dim CompareTo As Object
Dim returnValue As MailMergeField

returnValue = instance.AddNextIf(Range, _
    MergeField, Comparison, CompareTo)
MailMergeField AddNextIf(
    Range Range,
    string MergeField,
    WdMailMergeComparison Comparison,
    ref Object CompareTo


  • MergeField
    Type: System.String
    Required String. The merge field name.
  • CompareTo
    Type: System.Object%
    Required String. The text to compare with the contents of MergeField.

Return Value

Type: Microsoft.Office.Interop.Word.MailMergeField


A NEXTIF field compares two expressions, and if the comparison is true, the next data record is merged into the current merge document.

See Also


MailMergeFields Interface

MailMergeFields Members

Microsoft.Office.Interop.Word Namespace