EditGoTo

Syntax

EditGoTo .Destination = text

Remarks

Moves the insertion point or selection to the specified location or item, such
as a page, bookmark, footnote, line, or field. To move the insertion point to
a destination listed in the following table, use the corresponding identifier in combination with a number, the plus sign (+) or minus sign (–), or a string.

Destination

Identifier

Example text for .Destination

Page

p (or omitted)

The text "p5" or "5" goes to the fifth page.

Section

s

The text "s" goes to the next section.

Line

l

The text "l+5" goes to the fifth line after the current insertion point. The plus sign (+) means count forward from the insertion point.

Bookmark

(none)

The text "Temp" goes to the bookmark "Temp."

Annotation

a

The text "a'Sara Levine'" goes to the next mark for an annotation by Sara Levine.

Footnote

f

The text "f-" goes to the previous footnote reference mark. The minus sign (–) means count backward from the insertion point.


Destination

Identifier

Example text for .Destination

Endnote

e

The text "e5" goes to the fifth endnote reference mark.

Field

d

The text "d'TIME'" goes to the next TIME field. The single quotation marks separate the field type from the identifier.

Table

t

The text "t" goes to the next table.

Graphic

g

The text "g10" goes to the tenth graphic in the document.

Equation

q

The text "q-" goes to the previous equation.

Object

o

The text "o-'WordArt'" goes to the previous Microsoft WordArt object. The single quotation marks separate the object type from the identifier.


The following table summarizes the use of numbers and the plus sign or minus sign with destination identifiers in EditGoTo instructions. Numbers and the plus sign or minus sign can be used with every type of destination except bookmarks.

Identifier and this

Result

Number

Goes to an item according to its location within the document. For example, EditGoto "l30" goes to the thirtieth line in a document; EditGoto "f200" goes to the two-hundredth footnote.

+[Number] or –[Number]

Goes to an item relative to the current location. For example, EditGoto "l+2" goes to the second line after
the current line. Likewise, EditGoto "l-2" goes to the
second line before the current line. The instruction
EditGoto "l-" goes to the previous line; EditGoto "l+" goes to the next line.

Omitted

Goes to the next item specified. For example,
EditGoto "s" goes to the next section in the document.


Example

This example counts the number of tables in the document. The bookmark "Temp" is defined at each successive insertion point location so CmpBookmarks() can determine whether the most recent EditGoTo (or RepeatFind) instruction has moved the insertion point. When RepeatFind no longer moves the insertion point — that is, when there are no more tables — Word exits the While¼Wend loop.


StartOfDocument
EditBookmark "Temp", .Add
count = 0
If SelInfo(12) = - 1 Then count = 1
EditGoTo .Destination = "t"
While CmpBookmarks("\Sel", "Temp") <> 0
    EditBookmark "Temp", .Add
    count = count + 1
    RepeatFind
Wend
EditBookmark "Temp", .Delete
MsgBox "There are" + Str$(count) + " tables in the document"

See Also

EditFind, GoBack, GoToNextItem, GoToPreviousItem, NextField, NextObject, NextPage, PrevField, PrevObject, PrevPage, RepeatFind