Using Mail merge to enter and update information

R

Rcoppi

Hi,

I have several documents in which I enter a date in one location that must
be increased by 60 days in several other locations in the same document.
I've used ASK statements to automatically enter information that is entered
in response to my question in multiple locations in a document, but I'm not
sure how to do this, or if I even can do this. Help!!!!
 
G

Graham Mayor

Date calculations using fields are complicated. Most of the work has been
done for you - see the examples in fellow MVP Macropod's excellent work on
this topic, which can be downloaded from
http://www.gmayor.com/downloads.htm#Third_party
In the example substitute your Mergefield for the Date field(s).

Is this in fact a mail merge? You can use vba to insert calculated dates in
forms and documents, but we would need to know more to suggest the
appropriate code, but the basic format would be

Sub DatePlus60()
Dim bProtected As Boolean
'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect
End If

Selection.InsertBefore Format((Date + 60), "d" & _
Chr(160) & "MMMM" & Chr(160) & "yyyy")

'Reprotect the document.
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True
End If
End Sub

See also http://www.gmayor.com/insert_a_date_other_than_today.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

Rcoppi

Yes...unfortunately, I must use mail merge functionality to accomplish this
because the document generation program that calls this document was designed
to merge data from the program's database and from user input via mail merge
code. At some point in the future I would like to see if VBA will work with
my document generation program. I must say the mail merge functionality
works pretty well but it does have some limitations.
 
R

Rcoppi

Macropod,

Thank you, this worked GREAT!!!!
--
Rcoppi


macropod said:
To see how to do this and just about everything else you might want to do
with dates in Word, check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Date and Time Calculations In A Mailmerge'

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Rcoppi said:
Hi,

I have several documents in which I enter a date in one location that must
be increased by 60 days in several other locations in the same document.
I've used ASK statements to automatically enter information that is entered
in response to my question in multiple locations in a document, but I'm not
sure how to do this, or if I even can do this. Help!!!!
 
R

Rcoppi

--
Rcoppi


macropod said:
To see how to do this and just about everything else you might want to do
with dates in Word, check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Date and Time Calculations In A Mailmerge'

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Rcoppi said:
Hi,

I have several documents in which I enter a date in one location that must
be increased by 60 days in several other locations in the same document.
I've used ASK statements to automatically enter information that is entered
in response to my question in multiple locations in a document, but I'm not
sure how to do this, or if I even can do this. Help!!!!
 
R

Rcoppi

Dear Macropod,

Help.... my date calculation does not automatically update based on the
current date. This is the calculation I have in my document and it works
great the day I added to the document, but it does not update. The document
I am adding this calculation to is a template that is used daily by my users,
what do I need to add to the calculation to make it automatically update
whenever the document is generated.

For example, User #1 generates the document (using my template) on November
26th, I need the date of January 25, 2008 to be entered wherever I have the
date calculation logic. Then User #2 generates the same document (using my
template) on November 27, 2007. I need the date of January 26, 2008 to be
entered wherever I have the date calculation logic.

This is the date calculation logic I am using.
{QUOTE{{DATE /@ “MMMM d, yyyy†\* MERGEFORMAT}}{set Delay “60â€}{SET
d{StartDate \@ d}}{SET m{ StartDate \@ MM}}{StartDate \@ yyyy }}{SET
jd{=INT(365.25*(y+4799+INT((m+10)/12)))+INT(367/12*MOD(m+10,12))-INT(3*INT((y+4901+INT((m+10)/12))/100)/4)+d-32075}}{SET
jd{=jd+Delay }}{SET c
{=jd+68569-INT(36524.25*INT((jd+68569)/36524.25)+0.75)}}{ SET
f{=c-INT(365.25*INT((c+1)/365.25025))+31}}{SET
dd{=f-INT(30.58757*INT(f/30.58757))}}{SET
mm"{=INT(f/30.58757)+2-12*INT(INT(f/30.58757)/11)} /00"}{SET
yy{=100*(INT((jd+68569)/36524.25)-49)+INT((c+1)/365.25025)+INT(INT(f/30.58757)/11)}}{mm \@ MMMM } 160{dd}, 160{yy}â€â€}

Your help is GREATLY appreicated.
--
Rcoppi


macropod said:
To see how to do this and just about everything else you might want to do
with dates in Word, check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Date and Time Calculations In A Mailmerge'

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Rcoppi said:
Hi,

I have several documents in which I enter a date in one location that must
be increased by 60 days in several other locations in the same document.
I've used ASK statements to automatically enter information that is entered
in response to my question in multiple locations in a document, but I'm not
sure how to do this, or if I even can do this. Help!!!!
 
D

Doug Robbins - Word MVP

Put an autonew macro in the template that contains the command

ActiveDocument.Range.Fields.Update

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Rcoppi said:
Dear Macropod,

Help.... my date calculation does not automatically update based on the
current date. This is the calculation I have in my document and it works
great the day I added to the document, but it does not update. The
document
I am adding this calculation to is a template that is used daily by my
users,
what do I need to add to the calculation to make it automatically update
whenever the document is generated.

For example, User #1 generates the document (using my template) on
November
26th, I need the date of January 25, 2008 to be entered wherever I have
the
date calculation logic. Then User #2 generates the same document (using
my
template) on November 27, 2007. I need the date of January 26, 2008 to be
entered wherever I have the date calculation logic.

This is the date calculation logic I am using.
{QUOTE{{DATE /@ "MMMM d, yyyy" \* MERGEFORMAT}}{set Delay "60"}{SET
d{StartDate \@ d}}{SET m{ StartDate \@ MM}}{StartDate \@ yyyy }}{SET
jd{=INT(365.25*(y+4799+INT((m+10)/12)))+INT(367/12*MOD(m+10,12))-INT(3*INT((y+4901+INT((m+10)/12))/100)/4)+d-32075}}{SET
jd{=jd+Delay }}{SET c
{=jd+68569-INT(36524.25*INT((jd+68569)/36524.25)+0.75)}}{ SET
f{=c-INT(365.25*INT((c+1)/365.25025))+31}}{SET
dd{=f-INT(30.58757*INT(f/30.58757))}}{SET
mm"{=INT(f/30.58757)+2-12*INT(INT(f/30.58757)/11)} /00"}{SET
yy{=100*(INT((jd+68569)/36524.25)-49)+INT((c+1)/365.25025)+INT(INT(f/30.58757)/11)}}{mm
\@ MMMM } 160{dd}, 160{yy}""}

Your help is GREATLY appreicated.
--
Rcoppi


macropod said:
To see how to do this and just about everything else you might want to do
with dates in Word, check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Date and Time Calculations In A
Mailmerge'

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Rcoppi said:
Hi,

I have several documents in which I enter a date in one location that
must
be increased by 60 days in several other locations in the same
document.
I've used ASK statements to automatically enter information that is
entered
in response to my question in multiple locations in a document, but I'm
not
sure how to do this, or if I even can do this. Help!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top