Word count between two diffrent cursor positions

E

Eusebiu

Hello..
I am developing a Word Add-In and I let's say that I have a document that
has some lines(10 or more) and I click on the 9th line, on the first word.
After that I click on the 5th line on the third word...
I want to calculate how many words are between these two cursors
positions/locations.

Thanks...
 
C

Cindy M.

Hi =?Utf-8?B?RXVzZWJpdQ==?=,
I am developing a Word Add-In and I let's say that I have a document that
has some lines(10 or more) and I click on the 9th line, on the first word.
After that I click on the 5th line on the third word...
I want to calculate how many words are between these two cursors
positions/locations.
Instead of click....click use click...Shift+click to select the range. Then

Selection.Words.Count

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
E

Eusebiu

Hello...
As I said... I want to use click... not Shift+click... just 2 clicks... :)
Thanks..
 
T

Tony Jollans

I think you'll need to use the Application WindowSelectionChange Event to
register the clicks and save details - and, having done that, you'll need to
have your own mechanism for firing the Word Count (or trap the Word command)
as, by default, the built-in command will not know what Range to work on.
Quite an overhead just to avoid the user having to press Shift (or click and
hold).

You should be aware that enabling the WindowSelectionChange event has some
side effects - for example, double clicking the format painter button
doesn't behave 'properly'.
 

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