#  Other Applications & Softwares  > Word Formatting & General >  >  Auto Calculate Date based off Mail Merge Data

## mkn95u0

Does anyone know if it is possible to set up a mail merge to auto-calculate a date?

*Example*
I have the following line:

Renewal Policy Period: 7/15/2015 to "ToDate"

I would like "ToDate" to automatically calculate 1 year from the 7/15/2015 (7/15/2015 will pull from an excel sheet via mailmerge, and this date will ALWAYS be different, but the "ToDate" will always be 1 year after this field).

I do understand it would be easier to add it to excel and just have it as another merge field, but for this particular task, that's not an option. 

Thanks

----------


## LJMetzger

Hi mkn95u0,

Mail Merge itself cannot calculate the date to the best of my knowledge.

However, by using an Excel File to control the Mail Merge, Excel can edit the Word document to do what you want.  I have created two different scenarios:
a. Automated Mail Merge then automated date modification (one button press).
b. Automated Date modification of an existing Word file.

Please note that the ONLY date format supported by both of these scenarios is m/d/yyyy per your example.

In addition your text must be EXACTLY of the form 
*Renewal Policy Period: 7/15/2015 to "ToDate"* 
for date replacement to work.

See the attached zip file which performs scenario a. above and contains:
a. LJMOpenWordMailMerge5.xls - Master File that controls the Mail Merge
b. LJMMailMergeData5.xls - Sample Mail Merge Excel Data File
c. LJMMailMerge5.doc - Mail Merge Word File

Suggested implementation:
a. Download and extract the 3 files into the same folder.
b. Open file LJMOpenWordMailMerge5.xls.
c. 'Left Click' the Brown Shape to put the correct paths and file names for the default data files.
d. 'Left Click' the top left Yellow Shape to Perform the Mail Merge and date replacement.
e. If my files run successfully, put your (paths an) file names on line 25 and 27.

Lewis

----------


## LJMetzger

See the attached zip file which replaces text only.  The zip file contains:
a. LJMMicrosoftWordReplaceText.xls - Excel File that replaces the text in the Word file.
b.  LJMMicrosoftWordReplaceText.doc - Sample Word File

The text must be EXACTLY of the form
*Renewal Policy Period: 7/15/2015 to "ToDate"*
for date replacement to work.

Suggested implementation:
a. Download and extract the 2 files into the same folder.
b. Open file LJMMicrosoftWordReplaceText.xls.
c. 'Left Click' the Brown Shape to put the correct path and file name for the default data file.
d. 'Left Click' the top left Yellow Shape to Perform the date replacement.
e. If my file runs successfully, put your (path an) file name on line 28.

Lewis

----------


## macropod

Yes, you _can_ do date calculations in a mailmerge!

To see how to do just about everything you might want to do with dates in Word, check out my Microsoft Word Date Calculation Tutorial, at:
http://windowssecrets.com/forums/sho...ation-Tutorial
or:
http://www.gmayor.com/downloads.htm#Third_party
Do read the document's introductory material.

----------

