Consulting

Results 1 to 3 of 3

Thread: Move selection help

  1. #1

    Move selection help

    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

  2. #2
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    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:

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

    or

    [VBA] Selection.goto wdgotopage, wdgotorelative, +1
    selection.moveleft wdcharacter, 1[/VBA]

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

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  3. #3
    Thanks Tony:
    I will try both and see what works best.

    Stan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •