background process to monitor cursor location

J

James III

This is a followup question from a previously answered thread:
"clicking in protected forms: MS knowledge base article ID: 839950" from
March 26, 2008

The problem is:
In summary, the user must click or tab from one form field into another
form
field on a protected document or Word does not run the form field's 'on
entry' and 'on exit' macros.

My solution:
Inside the Document_Open() subroutine, I am using the Timer and DoEvents
functions in a While Loop to 'wait and watch' what the user is doing.

When the cursor is 'properly' placed or 'improperly' found on one of the
text form fields used for data entry, then a pointer to that field is stored.
If the focus is moved 'properly' to another form field, the pointer is set
to the new field. However, if/when the cursor is 'improperly' found in some
other location, the validation routine is run and the pointer is reset (or
set to the new data entry field).

Finally, I am using the Document_Close() subroutine to set a flag that
allows Word to kick out of the While Loop and exit the Document_Open()
subroutine.

My concern/question:
Practically this appears to be working, although it makes the response
sluggish (especially if focus is moved to a different Word Document).

However, there is so much in this Windows world that I don't know and I am
concerned that I have opened a 'pandora's box'. Does anyone see any danger
in using this methodology or have any other advice?

Thank you!
 
F

fumei via OfficeKB.com

The only thing is precisely what you have identified. It will slow things.
It has to. You are using system resources constantly.

Frankly, while I have been tempted (and given in for a little time) to use
this kind of constant monitoring, in the end, I have never, ever, used it in
a production environment.
 

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