Re: Counting Characters automatically by Jezebel
Jezebel
Mon Aug 02 22:24:53 CDT 2004
Sadly, Word doesn't provide any keyboard events. It's possible to do this
through API calls to check the message queue, but that's seriously tricky
programming.
You could just run an endless loop with a DoEvents statement in it; it would
have some impact on performance depending on the power of your machine -- on
a slow machine it might make the keyboard seem a shade sluggish, and it
could cause problems if you have other macros.
Not sure how you're going to flash messages at the user, either. You can
popup forms or message boxes, but they require user-intervention to clear.
You can also use the status bar, but the user might well not notice. Or do
dramatic things like change the background color, but that will frighten the
horses.
Probably better -- and certainly simpler -- to check the count on
completion, when the user tries to do something with the document.
"Wassim" <technologymd@juno.com> wrote in message
news:3a8080dc.0408021839.59e20b3f@posting.google.com...
> Hello Developers
>
> Is there a way in MS-Word 97 and up to count the number of characters
> automatically in real time as they are being typed.
>
> For example:
>
> If I have a document that must be 2000 characters long, I would like
> to count the characters so that when the user gets to 1990, I start
> flashing messages for the user to stop typing soon before the text
> becomes longer than 2000 characters.
>
> I am hoping to be able to have this happen dynamically as the user
> types, vs having the user hit a button to fire a macro and then the
> count will come out.
>
> So I think I need an event of a KeyDown or a keyboard buffer or any
> help from you.
>
> Thanks a lot.