Results 1 to 3 of 3

Thread: Date Field (97)

  1. #1
    Etuini
    Guest

    Date Field (97)

    Is it possible to have an automatic date field in word display 90 days from today. Excel will do it if you enter Date+90, but that doesn't work in word - can it be done?

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Field (97)

    A field code wizard might be able to show you a field that does it, but here's a macro that will:

    Sub InsertDueDate
    Selection.collapse
    Selection.text = Format(Date + 14, "MMMM d, YYYY")
    End sub
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,048
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Date Field (97)

    While you might could do this with a field, you could also empty a bathtub with a teaspoon. I wouldn't recommend doing either. Here is a field that does what you want for 14 days (and will work for up to 28 days) from <A target="_blank" HREF=http://www.addbalance.com/word/datefields2.htm> calculated dates in Word</A>. That page will also show you some VBA solutions.

    { QUOTE "{ SET Delay "14" }{ SET "DaysInMonth" { IF { CREATEDATE @ "MM" } <> 2 { = round(30.575*{ CREATEDATE @ "MM" },0)-ROUND(30.575*{ = { CREATEDATE @ "MM" } -1 },0) }{ IF { = MOD({ CREATEDATE @"yy" }, 4 ) } > 0 "28" "29" } } }{ SET "NextMonth" { IF { CREATEDATE @ "MM" } = 12 "1/97" "{ = { CREATEDATE @ "MM" } + 1 }/97 } }{ IF { = { REF Delay } + { CREATEDATE @ "dd" } } <= { DaysInMonth }{ CREATEDATE @ "MMMM { = { REF Delay} + { CREATEDATE @ "dd" } }, yyyy"}{ QUOTE { NextMonth @ "MMMM" } { = { REF Delay } + { CREATEDATE @ "dd" } - { DaysInMonth } }, { IF { } CREATEDATE @ "MM" } <> 12 { CREATEDATE @ "yyyy" }{ CREATEDATE @ "{ = 1 + { CREATEDATE @ "yyyy" } # "xxxx" }" } } } }" }

    The reason this is so complex is that our calendar is based on the vanity of certain Roman emperors and also has to account for the inconvenient fact that the Earth does not care what time it is in deciding how long it takes to go around the sun.

    If you really want a field and want to hire someone to write it for you, it could be done. You could also do it yourself and the above should give you a good start. It is likely to be about three times as complex as the above though and may slow your document display down if used much. Once you get beyond 28 days, you have to track not only what month the current month is but also what any intervening months are. At 28 days you are safe in assuming that the new date will not be more than one month from now. With 90 days you will have 1-3 intervening months.

    Take a look at the following dates:
    December 30, 2002 + 90 days = March 31, 2003
    Intervening months: January, February
    December 31, 2002 + 90 days = April 1, 2003
    Intervening months: January, February, March
    December 30, 2003 + 90 days = March 30, 2004
    Intervening months: January, February
    December 31, 2003 + 90 days = March 31, 2004
    Intervening months: January, February
    December 31, 2099 + 90 days = April 1, 2100
    Intervening months: January, February, March
    July 1, 2002 + 90 days = September 30, 2002
    Intervening month: August

    I think the above are correct. Your field has to give correct results for each. Have fun!
    Charles Kyle Kenyon
    Madison, Wisconsin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •