Document.GoTo method (Word)
Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.
Syntax
expression. GoTo
( _What_
, _Which_
, _Count_
, _Name_
)
expression Required. A variable that represents a Document object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
What | Optional | Variant | The kind of item to which the range or selection is moved. Can be one of the WdGoToItem constants. |
Which | Optional | Variant | The item to which the range or selection is moved. Can be one of the WdGoToDirection constants. |
Count | Optional | Variant | 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 value for the Count value. |
Name | Optional | Variant | If the What argument is wdGoToBookmark, wdGoToComment, wdGoToField, or wdGoToObject, this argument specifies a name. Only positive values are valid. To specify an item that precedes the range or selection, use wdGoToPrevious as the Which argument and specify a value for the Count argument. |
Remarks
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.
Example
This example sets R1 equal to the first footnote reference mark in the active document.
If ActiveDocument.Footnotes.Count >= 1 Then
Set R1 = ActiveDocument.GoTo(What:=wdGoToFootnote, _
Which:=wdGoToFirst)
R1.Expand Unit:=wdCharacter
End If
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기