View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default I want a form field to figure a date based on the letter date.

Hi ?B?VmlyZ2luaWEgTmF0aXZl?=,

I am creating a form letter for work with fields to be tabbed to for specific
dates and amounts. Several of the fields are dates that are 14, 29, and 39
days ahead of the date of the letter. I wants those fields to automatically
show those dates when the letter is opened in Word so that people will not
have to calculate the dates. I have tried creating a formula in the Text Form
Field Options Box, but the formats for the formula calculations do not
include a date format.

Word fields don't do a great job with date calculations. I recommend a macro to
fill in all the dates, including the "current" one. If you're creating a
template, then an AutoNew macro would trigger every time a new document is
created from the template. Example:

Sub AutoNew()
Dim doc As Word.Document
Dim Date14 As Date, Date29 as Date

Set doc = ActiveDocument
Date14 = DateAdd("d", 14, Date)
Date29 = DateAdd("d", 29, Date)
doc.FormFields("CurrentDate").Result _
= Format(Date, "mmmm d, yyyy")
doc.FormFields("Date14").Result _
= Format(Date14, "mm/dd/yyyy")
doc.FormFields("Date29").Result _
= Format(Date29, "mm/dd/yyyy")
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)