Hi Mark,
At its simplest:
Sub FutureDate()
MsgBox Format(DateAdd("d", 90, Now), "d MMMM yyyy")
End Sub
The format function is needed to strip off the time portion of the calculation.
If you want that date to go into a document, you'll need to specify the location. For example:
Sub FutureDate()
Selection.TypeText Text:=Format(DateAdd("d", 90, Now), "d MMMM yyyy")
End Sub
or, to insert the text at a nominated location without having to select it:
Sub FutureDate()
ActiveDocument.Bookmarks("BkMrk").Range.Text = Format(DateAdd("d", 90, Now), "d MMMM yyyy")
End Sub
Where 'BkMrk' is the name of a bookmark.
To see how to do this and just about everything else you might want to do with dates in Word using field coding instead of vba,
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
Do read the document's introductory material.
--
Cheers
macropod
[MVP - Microsoft Word]
Mark said:
I am trying to create a macro in Word (I have never done before) to calculate
a future date i.e., 90 days from the current date.
I found some information on line for the calculation command line but when I
run the macro, it inserts the command line where the future date is. What am
I doing wrong?