Word index at current cursor location

A

Ashish Sharma

Hi
I need to get the word index where the cursor is currently positioned

for example
if i have 3-7 sentence in my document

this is line one
cursor is at XXX word
this is line three and cursor is at XXX in above line

how shd i get
cursor location is at sentenc 2 and word 4

Regards
 
J

Jean-Guy Marcil

Ashish Sharma said:
Hi
I need to get the word index where the cursor is currently positioned

for example
if i have 3-7 sentence in my document

this is line one
cursor is at XXX word
this is line three and cursor is at XXX in above line

how shd i get
cursor location is at sentenc 2 and word 4

Use the Word Count Toolbar.

Tools > Word Count... > Show Toolbar

Place your cursor where you need the count.
Do CTRL-SHIFT-Home key
Select "Words" in the Word Count toolbar dropdown.
Word will give you the number of words in the selection, since your
selection ends with your target word, the total is the index you seek. There
is no "Sentence" in that dropdown. If all your paragraphs are one sentence
long, you can use the paragraph count (Or line count?), but add one because
the current paragraph is not counted unless its ¶ is part of the selection.

If you need a "real" sentence count, you will need VBA for that (I write
"real" because a sentence to Word maybe different from your concept of a
sentence...)
 
M

MLBARR

Ashish Sharma said:
Hi
I need to get the word index where the cursor is currently positioned

for example
if i have 3-7 sentence in my document

this is line one
cursor is at XXX word
this is line three and cursor is at XXX in above line

how shd i get
cursor location is at sentenc 2 and word 4

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top