How to move to last line of current page?

A

avkokin

Hello.
There is one document with many pages. The insert point is on one (on
any) page. I need to move to last line (in start this line) on this
page. How can I do it?
Thank you.
 
L

Lene Fredborg

Something like the following should work:

'Go to end of current page
ActiveDocument.Bookmarks("\Page").Range.Characters.Last.Select
'Move to start of the line
Selection.HomeKey wdLine

Note, however, that in case of the last page in a document, the “\Pageâ€
bookmark does not include the last paragraph mark on the page. Therefore, if
the last paragraph in the document is an empty paragraph and if the last page
contains more than that paragraph, the code above will position the insertion
marker in the start of the second last line.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
G

Graham Mayor

How about

Dim oPage As Range
Set oPage = ActiveDocument.Bookmarks("\page").Range
oPage.Select
With Selection
.EndKey
.HomeKey
End With


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top