I'm working on a word addin, and have made great progress with 80% of it. I
have got a new toolbar with 10 ne buttons, and thay are all working fine,
but I have one "background" task which I'm using a timer for. Every so
often it has to examine the document, and set a variable based on the number
of spelling errors. The thing is if someone if typing when my timer kicks
in, word starts to duplicate keystrokes.
So I'll get text like "continnnnue" where the "n" key has been duplicated.
I have written a low level hook to monitor the keyboard, and no extra key
events are being generated. If I delcare a range, and set it to be equal to
the selection at an instant when someone is typing, I get unpredictible
results.
I have tried using "BlockInput" to prevent typing while my processing is
happening (just for a split second) but very occasionally I get a missing
keystroke.
Has anyone seen this happening, or does anyone have a workaround?
Thanks in advance,
Martin
It may be worth noting that to declare a word.document in a VB form, and
then call
Set frm_Main.doc_CurrentDocument = doc
during the NewDocument, or DocumentChanged events does give you a valid
pointer to the current document which you can use to manipulate the
document, but if the user is typing, or the document is not ""static" when
you are doing your processing, then problems do occur which are pretty
unpredictible.
I have a workaround for my own need now though.
Best Wishes,
Martin