Calculated field in MS word base on another date field

Hi All,
I'm using MS Word 2010 need to add a date field (Report_Due_Date) that is calculated to greater than another date field (Report Generation Date).  Need to automatically run on document open.

Any ideas?

Thank you!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What sort of field? If you mean a Word field, then you should be aware that while arithmetic data calculation is available, it is very difficult to do it with dates. VBA calculation is much easier, but some users consider VBA too difficult to make secure.

How much greater do you need the second field to be?

I suggest that you post a non-confidential example document.
LadyHagoodAuthor Commented:
Yes a word field.  VBA calculation is fine the security is not a major concern for this particular usage.  Second field is 30 days greater than the first.
You will need a macro like this in the document's ThisDocument code module.
Option Explicit

Private Sub Document_Open()
    Dim rng2 As Range
    Dim dt1 As Date
    Dim dt2 As Date
    dt1 = ThisDocument.Fields(1).Result
    dt2 = DateAdd("d", 30, dt1)
    Set rng2 = ThisDocument.Bookmarks("Date2").Range
    rng2.Text = Format(dt2, "dd/MM/yyyy")
    ThisDocument.Bookmarks.Add "Date2", rng2
End Sub

Open in new window

I have attached a sample document. The second date is not a Word Field, but is shown in a bookmarked location.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: GrahamSkan (https:#a42390898)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.