Share via

VBA for updating specific fields

Anonymous
2013-11-06T18:32:55+00:00

Hello,

Let me first say that I understand noting of VBA, so please forgive any misconceptions on my part. I created a quotation-styled form with a few fields containing formulas (i.e. total price, taxes...) in Word. Their value depends on columns like product price, quantity, etc.

I would like to add an ActiveX button to update these specific fields once I have filled in the form (so the document would be protected). I have set bookmark names to them, since I assume the code would need to call them.

Also, I would like the button not to show when printing.

Can this be achieved? What would be the code?

Thank you.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Paul Edstein 82,861 Reputation points Volunteer Moderator
2013-11-06T23:10:20+00:00

The 'calculate on exit' property should be set on the input fields, not on the calculating fields. Additionally, using formfields to do the calculations is buggy; better to use formula fields for that.

To see how to do a wide range of calculations in Word using formula fields, check out my Microsoft Word Field Maths Tutorial, at:

http://windowssecrets.com/forums/showthread.php/154369-Microsoft-Word-Field-Maths-Tutorial

or

http://www.gmayor.com/downloads.htm#Third_party

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-11-06T23:27:35+00:00

    I always believed formula and calculating fields were basically the same, I'm glad you cleared that out for me.

    Thank you, this actually worked like a charm.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-11-06T23:05:01+00:00

    I have activated recalculating on exit, but my main problem is that I have protected the form so that people can only fill it in. Fields with formulas act as unmodifiable ones, so I can't actually tab out of them because they cannot be accessed. That is why I considered the button option.

    The fields I use are simple textboxes except those with formulas, both legacy form.

    Was this answer helpful?

    0 comments No comments
  3. Charles Kenyon 167.7K Reputation points Volunteer Moderator
    2013-11-06T20:09:21+00:00

    It might be possible, but desireable? Probably not. ActiveX requires macros and is old technology.

    If you use legacy form fields in your form and set them to calculate on exit, they will update whenever you tab out of them. Legacy form fields may also be old technology, but not that old.

    What kind of fields did you use in your form?

    Was this answer helpful?

    0 comments No comments