Re: Selecting the current word (including underscore characters) by Tony
Tony
Fri Nov 18 10:24:16 CST 2005
Hi David,
If you want other than Word's definition of a 'word', you must define your
own. You can extend the selection with something like
Selection.MoveEndUntil "., " & vbCr, wdForward
Selection.MoveStartUntil " " & vbCr, wdBackward
This will look forward for a full stop, comma, space, or carriage return and
backward for a space or carriage return. You will need to also look for
other characters depending on your text - semicolon, question mark, etc.-
and what you want to include in your 'word'.
--
Enjoy,
Tony
"davidS" <dstokar@yahoo.com> wrote in message
news:1132326576.776899.88980@o13g2000cwo.googlegroups.com...
> I am trying to write a Word macro that selects the current word and
> then does some processing on that word. What method can I use to
> select the current word (ie the one where the cursor is). The words
> may contain undercores so I want it to select the whole word. For
> example the word may be T_demog.
>
> Thanks,
> David
>