I created a template in Word 2007 that uses formfields (legacy). Every formfield has its own bookmark, which made it great to calculate further with these fields. The results of the calculation then again was used as a bookmark to show up somewhere else in the document.
Problem for the people filling in the template: it wasnt clear which fields they should edit and which they should just leave alone and let them be calculated automatically.
So i managed to create a userform in vba with only the necessary fields. This form replaces the bookmarks in the doc with the text values from the form. That way it removes the bookmarks and no more automatic calculations with the variables from the userform are done. Can I submit fields from the form into formfields of the word doc, rather than replace them?
For example: in the userform txtDays is submitted to bkDays and txtFee is submitted to bkFee. Then in the word doc I have a field that calculates (bkDays*bkFee) which gives me bkTotal and that last bookmark is used in different locations around the doc. Problem is that bkDays and bkFee are replaced with the textvalue so no more calculations are done.
I have no vba background so I was happy enough to toy the form together from tutorials around the web but now i’m a bit stuck and i have the feeling that i’m awefully close. This is what is used to pass the data from the userform to the worddoc when OK is clicked:
With ActiveDocument
.Bookmarks(“bkDays”).Range.Text = txtDays.Value
Kind Regards Sven