GoToNext Method

Applies To

MailMessage object, Range object, Selection object.

Description

Range or Selection object: Returns a Range object that refers to the start position of the next item or location specified by the What argument. If you apply this method to the Selection object, the method moves the selection to the specified item (except for the wdGoToGrammaticalError, wdGoToProofreadingError, and wdGoToSpellingError constants).

Note When you use this method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range object that's returned includes any grammar error text or spelling error text.

MailMessage object: Displays the next mail message if WordMail is available.

Syntax 1

expression.GoToNext(What)

Syntax 2

expression.GoToNext

expression Required. An expression that returns a Range or Selection object (Syntax 1) or a MailMessage object (Syntax 2).

What Required Long. The item that the specified range or selection it to be moved to. Can be one of the following WdGoToItem constants: wdGoToBookmark, wdGoToComment, wdGoToEndnote, wdGoToEquation, wdGoToField, wdGoToFootnote, wdGoToGrammaticalError, wdGoToGraphic, wdGoToHeading, wdGoToLine, wdGoToObject, wdGoToPage, wdGoToPercent, wdGoToProofreadingError, wdGoToSection, wdGoToSpellingError, or wdGoToTable.

See Also

GoTo method, GoToPrevious method, Next property, NextField method, NextSubdocument method, Target property.

Example

This example adds a bookmark at the top of page 2 in the active document.

Set myRange = ActiveDocument.Words(1).GoToNext(What:=wdGoToPage)
ActiveDocument.Bookmarks.Add Name:="Page2", Range:=myRange
This example moves to the next field and selects it.

With Selection
    Set myRange = .GoToNext(What:=wdGoToField)
    .MoveRight Unit:=wdWord, Extend:=wdExtend
    .Fields(1).Select
End With