PDA

View Full Version : Auto Update a field with formula in a protected document.



Eduardo Care
08-31-2015, 05:24 PM
Im about to shot myself,im trying to design a protected document, which must have few writable parts which are bookmarked for a field formula in order to create a value for another bookmark that is followed by "IF" Fields which auto select certain check-boxes in the same document.

I'm fairly new to macros, and i have been supported by multiple users which helped me greatly in order to learn all of the above, my problem its that i cant find a way to auto update this field formula so whenever i change any bookmark to another value this field formula must change too.

Another way to fix this would be make a macro constantly run over and over which would be updating my fields in the doc since the only way i can update my fields with a macro its by making a button, this way doesn't work for my situation , but i'm not skilled enough yet to make something like this, so i would appreciate any help.



Thanks in advance.

Eduardo.

gmayor
09-01-2015, 12:07 AM
If you are using legacy form fields then REF fields based on the contents of those form fields update automatically if you check the calculate on exit check box property of those fields. You can force an update using exit macros on form fields that contribute to the result. A typical update macro can be found at http://www.gmayor.com/installing_macro.htm

If you are using content controls you need to employ the exit event of the control. This is covered at http://gregmaxey.mvps.org/word_tip_pages/validate_content_control_entries.html and http://gregmaxey.mvps.org/word_tip_pages/content_control_custom_events.html

Eduardo Care
09-02-2015, 02:30 PM
Gmayor, i read both of the tutorials and i found them awesome, the one that would work wonders for my problem are the content controls, because i need to protect the final document, so i end up searching and found another of your tutorials:

/word_tip_pages/content_controls_use_in_math_operations.html

Where you clearly explain how to use the content control to manipulate multiple variables, what i was trying to do was adding a formula instead of a simple math operation, which would be the following

=(A+B)*(C+D) Nothing so complex, but i didn't manage to create myself :banghead:

Also in the tutorial you use text content control to put the numbers, and add the property of "content controls cannot be deleted" i would like to know if it its possible making those number values a Drop Down list with only few values. A document with an example would be Highly Appreciate, thanks in advance and ill keep learning from your tutorials C:

gmayor
09-02-2015, 09:19 PM
The tutorials are from Greg Maxey's web site. Despite the similar initials we are different people.

For a form to be distributed to other users, I would recommend, where it is possible, a solution that does not require macros, which you cannot force a user to run. I would therefore recommend the use of legacy form fields as shown in the example I posted to your thread at http://www.msofficeforums.com/word-vba/27690-continuously-runing-macro.html

gmaxey
09-03-2015, 04:45 AM
Right. He likes blood pudding and I don't.