GoToNext Method

Microsoft Word Visual Basic

Show All

GoToNext Method

       

GoToNext method as it applies to the Range and Selection objects.

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). Range object.

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.

expression.GoToNext(What)

expression   Required. An expression that returns one of the above objects.

What  Required WdGoToItem.

WdGoToItem can be one of these WdGoToItem constants.
wdGoToComment
wdGoToEquation
wdGoToFootnote
wdGoToGraphic
wdGoToLine
wdGoToPage
wdGoToProofreadingError
wdGoToSpellingError
wdGoToBookmark
wdGoToEndnote
wdGoToField
wdGoToGrammaticalError
wdGoToHeading
wdGoToObject
wdGoToPercent
wdGoToSection
wdGoToTable

 

GoToNext method as it applies to the MailMessage object.

Displays the next mail message if you are using Word as your e-mail editor.

expression.GoToNext

expression   Required. An expression that returns one of the above objects.

 

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