calculating dates in a Word form

  • Thread starter Thread starter mbrancheau
  • Start date Start date
M

mbrancheau

Is there a way I can insert a date into a form field, and then have that date
update other, different dates? Specifically, I want the people using my form
to insert a project due date, then the form will populate a timeline of
different dates based on the due date for when the steps of the project need
to be completed.

Thanks!
 
mbrancheau said:
Is there a way I can insert a date into a form field, and then have
that date update other, different dates? Specifically, I want the
people using my form to insert a project due date, then the form will
populate a timeline of different dates based on the due date for when
the steps of the project need to be completed.

Thanks!

See
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Concerning dates in Word Form and DateCalc 'tutorial':
Is there a way to call forand use the value from a form DropDown List Box
instead of use the SET Delay xx value in the field code given in DateCalc
examples?

/Silfver

*****
 
Probably easier to have a macro that runs on exit from the dropdown that
uses the .Result of the dropdown in the DateAdd function

Assuming that the start date was in a formfield with the bookmark name of
StartDate and the dropdown has the bookmark Interval (which is specified in
days) and you want the result to appear in a formfield with the bookmark
name of EndDate, use

With ActiveDocument
.FormFields("EndDate").result = Format(DateAdd("d",
..FormFields("Interval").result, _
.FormFields("StartDate").result), "d MMMM yyyy")
End With


--
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, originally posted via msnews.microsoft.com
 
As Doug says it is easier to use a macro run on exit from a field to insert
a required date, but it is also possible to use the numeric value from the
dropdown field in the datecalc calculation. If we assume that the Dropdown
field with the delays is bookmarked Dropdown1, set its calculate on exit
check box and in the datecalculation use {SET Delay { REF Dropdown1 }}

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Thanks Macropod and Graham Mayor. I have followed your field codes and tip
concerning calculating dates in a Word document. Works very well so now I can
choose among four different delay days from a field list box and let the Date
Calc code calculate from that.

I wanted to use Macropods field code examples (Date Calc) instead of macros
with VBA, because some friends that will use my documents not will deal with
VBA on their computers.

While it works so well I will try experimenting with the even more and
elegant code Handling Weekends and Holidays if a calculated date will end up
on a weekend or holiday.

But here in Sweden we have little different Holidays than in Australian
Capital Territory as in the code example.

We have not so many Holidays as in ACT, no Anzac and so on. Instead we have
some special Swedish Holidays. Christmas nearly the same, but our
correspondence day to Boxing Day is always on 26th December independent of
Saturday-Sunday. Easter seems to be the same. But then we have Ascension Day
as a holiday, always on a Thursday, calculated depending on Easter Day. And
then some Holidays on fixed dates. And some that always fall on a Saturday or
Sunday, so them I need not to calculate anyway.

I have some questions on how to change in the Following Business Day code by
Macropod to adapting for Swedish calendar:

1. Can I just erase from the code the ACT dependent holidays?
2. How to add code for Swedish holidays. Some hints..?
3. Do I have to change the SET Adj… code rows in any way?

Hoping for some hints…

/Silfver
 
Macropod is from Australia thus has based the codes on dates with which he
uses at home. The field samples explain how to create fixed holidays. You
can replace the examples with your own and remove (all references to) those
that don't apply.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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

Back
Top