Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Oct 2001
    Location
    New York, New York, USA
    Posts
    538
    Thanks
    0
    Thanked 1 Time in 1 Post

    'Unhighlighting' code (Word97/SR2)

    Am trying to create a macro that select the active document, updates the fields, saves the document. After this is run, the document is still highlghted. What do I add to the code to

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: 'Unhighlighting' code (Word97/SR2)

    Check out the Selection.Collapse method, which let's you reposition the insertion point either at the beginning or at the end of the selection.

    You also can use the VBA equivalents of the Home and End keys (Selection.HomeKey, Selection.EndKey), but if the whole document is selected, Collapse is easier. (Typed from memory, so apologies in advance for any errors!)

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: 'Unhighlighting' code (Word97/SR2)

    Oh, thinking outside the box, a more direct route might be:

    ActiveDocument.Fields.Update

    No need to do anything with the selection, unless you really want to. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  4. #4
    4 Star Lounger
    Join Date
    Oct 2001
    Location
    New York, New York, USA
    Posts
    538
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: 'Unhighlighting' code (Word97/SR2)

    Hi, Jefferson -

    Outside the box is a good place to think. Works great. Thanks!

Posting Permissions

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