Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Can a date be generated based on another date in the document
I have a template we use and the currrent date is entered into a field and we
would like for another field to have a date in the future (months or years) based on the current date |
#2
|
|||
|
|||
I would do this document in Excel where I know you can do this. Also
remember, Excel prints out just like Word does. -- Top Notch Admin "mfelps2" wrote: I have a template we use and the currrent date is entered into a field and we would like for another field to have a date in the future (months or years) based on the current date |
#3
|
|||
|
|||
You can use the code below to do what you want:
ActiveDocument.FormFields("myDate").Result = _ Format((Date + 7), "m/d/yy") To test the above code...add a TextBox form field into a document. Double click the form field and set the bookmark name to myDate. Then run this code. This will insert the date 7 days from now into the form field. If you are using a date field now, just remove that and insert a form field and use the code as needed...modifying the + 7 to whatever advanced days you need and "m/d/yy" to whatever format you want. You can also do this with a bookmarked location. Insert a bookmark where the date should go...then run your code. However, in that case (if you use a bookmark), you'll need to use this version of the code, since it's no longer a form field... Selection.GoTo What:=wdGoToBookmark, Name:="myDate" Selection.InsertAfter Format((Date + 7), "m/d/yy") Note...for more info on Forms creation...see this link: Word AutoForm Articles http://www.mousetrax.com/techpage.html#autoforms Dian D. Chapman, Technical Consultant Microsoft MVP, MOS Certified Editor/TechTrax Ezine Free MS Tutorials: http://www.mousetrax.com/techtrax Free Word eBook: http://www.mousetrax.com/books.html Optimize your business docs: http://www.mousetrax.com/consulting Learn VBA the easy way: http://www.mousetrax.com/techcourses.html On Tue, 17 May 2005 16:19:46 -0700, "mfelps2" wrote: I have a template we use and the currrent date is entered into a field and we would like for another field to have a date in the future (months or years) based on the current date |
#4
|
|||
|
|||
Calculations of dates using date fields is quite complicated, however the
work has already been done for you - see http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org mfelps2 wrote: I have a template we use and the currrent date is entered into a field and we would like for another field to have a date in the future (months or years) based on the current date |
#5
|
|||
|
|||
Hi,
To see how to do this, go to: http://www.wopr.com/cgi-bin/w3t/show...&Number=249902 (url all one line) Where you can download a Word document that uses fields to do this and much more with dates. No macros required!! Cheers "mfelps2" wrote in message ... I have a template we use and the currrent date is entered into a field and we would like for another field to have a date in the future (months or years) based on the current date |
#6
|
|||
|
|||
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 pages with fields and an explanation of different macros that can be used instead of fields. -- 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://www.mvps.org/word 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. "mfelps2" wrote in message ... I have a template we use and the currrent date is entered into a field and we would like for another field to have a date in the future (months or years) based on the current date |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to keep date issued (not created) on protected form? | Microsoft Word Help | |||
Insert Date of Creation | New Users | |||
How do I insert a current date in a template and then keep this i. | Microsoft Word Help | |||
using date field in merge | Mailmerge | |||
How to insert future date based on current date plus 14 days | Microsoft Word Help |