Move cursor to end of a word

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
wdc

Move cursor to end of a word

Post by wdc » Mon Jun 09, 2003 1:32 am

Given a chunk of text in Word 97, I’d like to make a listing of each word in the text.

Thus, for the chunk “The lazy fox jumped.â€Â

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Jun 09, 2003 3:22 am

Hello wdc........

You asked:
Is there a command in MS5.0 that moves the cursor to the end of a word?
I have two answers for you:
========================
1. The quick answer is NO.

But I made a suggestion on 5/29/03 to someone who had a similar question. It was related to email, but I think that the answer could be adapted to your needs. (Ignore the comments about comparing the words to a master list).

It may look like a lot of steps, but don't let that overwhelm you. Just go a step at a time.

See the following message, and my response on 5/29.
http://www.mjtnet.com/usergroup/viewtopic.php?t=435

Someone else may have an easier method, so stay tuned.....
=======================

2. If you are using Macro Scheduler with a text/word processor, than you may be able to use Macro Scheduler to go to the end of each word.

Most processors have a "Search/Replace" function. You could make a hot-key macro to do a "Search" for a space character.
How to do that will depend on the processor program you are using. If it supports Regular Expressions (Regex) then you could use that in your Search criteria.
==========================

Hope this helps............good luck,
Bob

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Jun 09, 2003 3:46 am

:oops: Oops...
Just noticed you mentioned you were using Word 97. I missed that in my previous response..... :oops:

Here is a quick and dirty method in Word, just the concept of the steps, not the macro code at this point.

1. Go to start of line
2. Do find for space band (CTL-F)(ALT-N)(Space)(ALT-F)
3. Close find window(ALT-F4)
4. Shift Home to select word
5. Do CTL-X to cut and store in clipboard
6. Use paste to put clipboard in new document or wherever needed.
7. Repeat steps 1-6 in a loop.

Some problems I can see, including last word in paragraph will not be picked up. Possible to pick up some formatting with the Paragraph mark.

Again, not fully thought out, just my first response.....
==============================

You could make a hot-key macro to do steps 2-5 if you wanted to do this manually. Turning on "Make All Characters Visible" can help if doing manually (Tools, Options, View, Non Printing Characters).

Move the cursor to the beginning of the word, and press the hot-key.

Now you can manually Paste, or call another macro to deal with what is in the clipboard.
========================

Another approach would be to do a Search and Replace, searching for space bands, and replacing with Return codes. Would still have problem with last words in paragraphs. Could do a Search and Replace first to replace Paragraphs with Space. Then need to clean up and replace all multiple spaces with a single space. Now search and Replace Space with Return. This is similar to appraoch I referred to in my previous posting.......
======================

Again, hope this was helpful.........good luck,
Bob

Guest

Post by Guest » Mon Jun 09, 2003 3:28 pm

Bob: Thank so much. I get the idea and will try to follow through. ... wdc

Lumumba

Post by Lumumba » Tue Jun 10, 2003 8:57 am

As you work with Word97 you should have a look at the WordHelp!
Keyword: Keyboard Shortcut

---

One character to the right SHIFT+RIGHT ARROW

One character to the left SHIFT+LEFT ARROW

To the end of a word CTRL+SHIFT+RIGHT ARROW

To the beginning of a word CTRL+SHIFT+LEFT ARROW

To the end of a line SHIFT+END

To the beginning of a line SHIFT+HOME

One line down SHIFT+DOWN ARROW

One line up SHIFT+UP ARROW

To the end of a paragraph CTRL+SHIFT+DOWN ARROW

To the beginning of a paragraph CTRL+SHIFT+UP ARROW

One screen down SHIFT+PAGE DOWN

One screen up SHIFT+PAGE UP

To the end of a window ALT+CTRL+PAGE DOWN

To the beginning of a document CTRL+SHIFT+HOME

To include the entire document CTRL+A

To a vertical block of text CTRL+SHIFT+F8, and then use the arrow keys; press ESC to cancel selection mode

To a specific location in a document F8+arrow keys; press ESC to cancel selection mode

:idea: Tip:
If you know the key combination to move the insertion point, you can select the text by using the same key combination while holding down SHIFT.
For example, CTRL+RIGHT ARROW moves the insertion point to the next word, and CTRL+SHIFT+RIGHT ARROW selects the text from the insertion point to the beginning of the next word.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Jun 10, 2003 9:44 pm

AND....the CTRL-SHIFT-RIGHT ARROW also takes care of the last word of the paragraph that searching for spaces does not do.

Thanks for bring up the shortkeys Lumumba......

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Re: Move cursor to end of a word

Post by support » Wed Jun 11, 2003 7:31 am

wdc wrote:Is there a command in MS5.0 that moves the cursor to the end of a word?
Yes, it belongs to Windows and it is CTRL-RIGHT. So in Macro Scheduler it is:

Press CTRL
Press Right
Release CTRL

You can also go back with CTRL-LEFT
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts