Can a doc template show a date range according to when its opened

C

Chris

I email a letter once a week that states what I did that week and what I will
do the next week. ie: 04-11 May conducted administrative duties.
12-19 May conduct trip preparations.
The day that I e-mail the letter is constant, like every thursday. Is there
a way to set up a template that changes those dates shown above,by one week
every time I open the template on thursday?
 
G

Greg Maxey

What do you want it to say for the week:

28 May - 04 June?

It would be pretty tricky to come up with code the show 04-11 May or 28
May - 04 Jun.

However, if you can live with 04 May - 11 May and 28 May - 04 June that
would be pretty easy.

Enter field brackets CTRL+F9. Insdie the brackets, type DATE \@ "dd MMM"

Toggle the code ALT+F9

The field shows 04 May

Select the field text and bookmark it "Start"

Type a dash and then bookmark the IP "End"

Use this macro:

Sub AutoOpen()
Dim oDate1 As Date
Dim oDate2 As Date
Dim oRng As Word.Range
Set oRng = ActiveDocument.Bookmarks("End").Range
oDate1 = ActiveDocument.Bookmarks("Start").Range.Text
oDate2 = DateAdd("d", 7, oDate1)
oRng.Text = Format(oDate2, "dd - MMM")
ActiveDocument.Bookmarks.Add Name:="End", Range:=oRng
End Sub
 
C

Charles Kenyon

If you create a new document based on your template (not open the template)
you can use createdate fields and calculation fields. This is more complex
than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the different
kinds of ways to make a date calculation work. It includes links to
utilities to create the fields and an explanation of different macros that
can be used instead of fields. It also has a link to
www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902 which is a document
with various fields already created. Another resource is
http://www.gmayor.com/insert_a_date_other_than_today.htm.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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