Link to home
Start Free TrialLog in
Avatar of mat_w
mat_w

asked on

Macro: Move to end of page in Word

What is the Word 97 marco code to move to the end of the current page?  I need something that will work no matter if I'm on the last page of the document or in the middle somewhere.  Everything that I have tried doesn't work for both instances.

I know this is probably simple, but I can't find an example or info anywhere!

Thanks!
Avatar of calacuccia
calacuccia
Flag of Belgium image

Hi Mat_W,

Not as simple as that:

In Word VBA, you can use this little sub (or just the code inside):

Sub GoToEndOfPage()
Selection.GoTo What:=wdGoToBookmark, Name:="\Page"
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End Sub


IF calling Word from externally, with the Word Application called wdApp, use

wdApp.Selection.GoTo What:=wdGoToBookmark, Name:="\Page"
wdApp.Selection.MoveRight Unit:=wdCharacter, Count:=1
wdApp.Selection.MoveLeft Unit:=wdCharacter, Count:=1


Hope this helps
Calacuccia
ASKER CERTIFIED SOLUTION
Avatar of ture
ture

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial