Search code examples
vbams-word

Jump to an absolute page from the beginning of the document


How do I jump to a specific page from the beginning of the document, such as page 20, When on page 10 the numbering starts from 1?

I tried the following code, and it jumped to page 30, which is 20 pages after the numbering started again, but not from the beginning of the document.

Selection.GoTo what:=wdGoToPage, with:=wdGoToAbsolute, Name:=20

Solution

  • That's because you're using Name:=20

    Instead, use Count:

    Selection.GoTo what:=wdGoToPage, which:=wdGoToAbsolute, Count:=20