Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 05 May 2006 00:08 GMT
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?
Greg Maxey - 05 May 2006 00:45 GMT
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

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> 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
[quoted text clipped - 3 lines]
> 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?
Charles Kenyon - 05 May 2006 02:56 GMT
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.

Signature

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

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
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.

>I email a letter once a week that states what I did that week and what I
>will
[quoted text clipped - 6 lines]
> week
> every time I open the template on thursday?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.