PDA

View Full Version : Move selection help



Stan Banner
12-01-2004, 10:26 AM
Hi anyone:
I hope that someone will supply me with a line or two of vba code that I can stick to the end of a macro that I am presently using.
The macro preforms an action on a page of a document, and leaves the selection where this action was preformed. I would like the macro to move to the last line at the bottom of this page, not the end of the document, to prepare for more text entrys. The page always ends with a carridge return.
Thanks

Stan

TonyJollans
12-01-2004, 06:45 PM
Hi Stan,

A couple of options for you to play with, both of which go to the first position on the next page and then back up a position. You may want to insert a carriage return after that:

Selection.bookmarks("\page").select
selection.collapse wdcollapseEnd
selection.moveleft wdcharacter, 1

or

Selection.goto wdgotopage, wdgotorelative, +1
selection.moveleft wdcharacter, 1

These behave slightly differently on the last page of the document - experiment to decide what to do for the best.

Stan Banner
12-03-2004, 02:11 PM
Thanks Tony:
I will try both and see what works best.

Stan