Selection.GoTo Method

Moves the insertion point to the character position immediately preceding the specified item.

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


Function GoTo ( _
    ByRef What As Object, _
    ByRef Which As Object, _
    ByRef Count As Object, _
    ByRef Name As Object _
) As Range
Dim instance As Selection
Dim What As Object
Dim Which As Object
Dim Count As Object
Dim Name As Object
Dim returnValue As Range

returnValue = instance.GoTo(What, Which, _
    Count, Name)
Range GoTo(
    ref Object What,
    ref Object Which,
    ref Object Count,
    ref Object Name


  • What
    Type: System.Object%
    Optional Object. The kind of item to which the selection is moved. Can be one of the WdGoToItem constants.
  • Count
    Type: System.Object%
    Optional Object. The number of the item in the document. The default value is 1.
    Only positive values are valid. To specify an item that precedes the range or selection, use wdGoToPrevious as the Which argument and specify a Count value.
  • Name
    Type: System.Object%
    Optional Object. If the What argument is wdGoToBookmark, wdGoToComment, wdGoToField, or wdGoToObject, this argument specifies a name.

Return Value

Type: Microsoft.Office.Interop.Word.Range


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

See Also


Selection Interface

Selection Members

Microsoft.Office.Interop.Word Namespace