Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word's run-macro-on-exit of field only fires off...

Status
Not open for further replies.

JJooee

Programmer
Jun 28, 2011
4
US
Word's run-macro-on-exit of field only fires off if I tab to the next field or if I put my cursor into another field. If I enter text, then click anywhere else outside the fields, the macro does not run. I'm pretty sure that would be considered exiting a field too, no? I need a calculation to run when a user exits the field, no matter how they exit. Can this be done?
 



Hi,

Have you not enabled protection before your user operates the fields?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Yes, it's definitely protected (editing restricted for filling in forms - Word 2007).
 


Then how can you put your cursor into anything BUT a form field?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
In a word: No. Your observations are correct, and there isn't much you can do.

Word Forms are relatively primitive and guaranteeing code will run in all circumstances is nigh impossible. You should be able to use document events (beforesave, for example) to trap anything that may have slipped through the cracks.


Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
@SkipVought: slight distinction - if I "click" anywhere else - not "put my cursor" anywhere else. For example, if I click on some protected text, the current field becomes deselected but does not run the exit macro. The cursor usually ends up inside the next closest field. I have multiple tables, and each one has a form field of its own inside it. The total at the bottom should always update when the user exits any of the fields.

@TonyJollans: Thanks. If that's true, then I guess I have to dumb it down and make the user hit a button to get the total. If not, then they could click out and think the total is up to date when in fact, the last calc didn't run.
 



If you are doing aggregating, why not Excel?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Oh yes - if the user is expecting to note a computed value before exiting, you need to make sure the calc has run! You might be able to use the Application WindowSelectionChange Event, but I can't think of much else.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
We chose Word because there's a lot of prose. It's an employee evalation that's more like a Word document than Excel. If I could do it all over again, I'd go with Excel now that I know about this problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top