NextField, NextField()

Syntax

NextField

NextField()

Remarks

The NextField statement selects the next field, regardless of whether the field is showing its codes or results. NextField skips over the following fields, which are formatted as hidden text: XE (Index Entry), TA (Table of Authorities Entry),
TC (Table of Contents Entry), and RD (Referenced Document).

The NextField() function behaves the same as the statement and also returns the following values.

Value

Explanation

0 (zero)

If there is no next field (in other words, if the selection is not moved)

1

If the selection is moved


With field codes displayed, you can use EditFind to go to the next field of any type, including XE, TA, TC, and RD fields, provided that hidden text is displayed. Specify "^d" (the code for a field character) as the text for the .Find argument, as shown in the following instructions:


ViewFieldCodes 1
EditFind .Find = "^d", .Direction = 0, .Format = 0

To find only XE fields, specify "^d XE" as the text to find.

Example

This example counts the number of fields in the document (excluding XE, TA, TC, and RD fields) and displays the result in a message box. Note that the
While¼Wend loop does not include a NextField statement because the While NextField() instruction also moves the selection.


StartOfDocument
count = 0
While NextField()
    count = count + 1
Wend
MsgBox "Number of fields in the document:" + Str$(Count)

See Also

PrevField