+ Reply to Thread
Results 1 to 1 of 1

Select whole word at cursor position

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Select whole word at cursor position

    Hi,

    Assume my cursor is placed within a random word of a document.

    I'm looking for a VBA command which will select this whole word.
    (Similar to double-clicking).

    The code should select the word in 3 various cursor positions:

    1) Within the word (between its characters).
    2) At the beginning of the word (between the first character and the leading space).
    3) At the end of the word between the last character and the following space).

    I'm familiar with the code for selecting the whole line, at the cursors position:
    Please Login or Register  to view this content.
    but could not figure out how to implement it for a single word.

    As more as I think of it - it sounds some very similar to the Dictionary implementation - saying: the dictionary recognizes the whole word from only placing the cursor between its characters.

    Farther more, if the code could return the words Number - I would be able to implement what ever I need by pointing to ActiveDocument.Words(x).

    Thanks, Elm

    ========================================

    Never mind.

    It was solved by a member of another forum - using: Selection.Expand Unit:=wdWord
    Last edited by ElmerS; 02-14-2009 at 01:55 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1