Share via


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)

Syntax

'Declaration
Function AddNextIf ( _
    Range As Range, _
    MergeField As String, _
    Comparison As WdMailMergeComparison, _
    ByRef CompareTo As Object _
) As MailMergeField
'Usage
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
)

Parameters

  • 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

Remarks

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

Reference

MailMergeFields Interface

MailMergeFields Members

Microsoft.Office.Interop.Word Namespace