automatic date

K

K.B. Yap

Hallo,


I am trying to make a document with an automatic date for
today, tomorrow and the day after tomorrow. For the date
of today it is easy (automatic ON), but how can I make
(today) the date of tomorrow automatic? I hope you
understand what the problem is. It is about a letter for a
saturday and sunday which we sent on friday.

I'm not sure in which group I have to ask this question

K.B. Yap
 
D

Doug Robbins - Word MVP

Hi K.B,

If you create a template for those letters and in that template you have
bookmarks named Friday, Saturday and Sunday and if you have a macro in the
template named autonew that contains the following code:

Dim i As Integer
i = 6 - Weekday(Date)
With ActiveDocument
.Bookmarks("Friday").Range.InsertBefore Format(DateAdd("d", i, Date),
"MMMM dd, yyyy")
.Bookmarks("Saturday").Range.InsertBefore Format(DateAdd("d", i + 1,
Date), "MMMM dd, yyyy")
.Bookmarks("Sunday").Range.InsertBefore Format(DateAdd("d", i + 2,
Date), "MMMM dd, yyyy")
End With

It will insert the dates for the next Friday, Saturday and Sunday if you
create the document by selecting New from the File menu and selecting that
template on any day of the week but Saturday.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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