#1
|
|||
|
|||
Create Field That Displays Date+30, Office 2007
I am trying to create a field that when the Word file is opened automatically displays the current date + 30 days in the format 11/04/2016.
I have looked into the non-trivial field format but it doesn't display anything: Code:
{ QUOTE "{ SET " Delay" "30" } { SET "DaysInMonth" { IF { CreateDate \@ "MM" } <> 2 { = ROUND(30.575*{ CreateDate \@ "MM" },0)- ROUND(30.575*{ = { CreateDate \@ "MM" } -1 },0) } { IF { = MOD( { CreateDate \@"yy" } , 4 ) } > 0 "28" "29" } } } { SET "NextMonth" { IF { CreateDate \@ "MM" } = 12 "1/97" "{ = { CreateDate \@ "MM" } + 1 }/97 } } { IF { = { REF "Delay" } + { CreateDate \@ "dd" } } <= { REF"DaysInMonth" } { CreateDate \@ "MMMM { = { REF "Delay" } + { CreateDate \@ "dd" } }, yyyy"}{ QUOTE { NextMonth \@ "MMMM" } { = { REF "Delay" } + { CreateDate \@ "dd" } - { REF"DaysInMonth" } }, { IF { CreateDate \@ "MM" } <> 12 { CreateDate \@ "yyyy" } { CreateDate \@ "{ = 1 + { CreateDate \@ "yyyy" } \# "xxxx" }" } } } }" } |
#2
|
|||
|
|||
It looks as if you copied that field from my web page. Calculated Dates in Microsoft Word using Fields or vba
That field has line breaks to show the field without running off the page. Spacing is crucial. In addition, it only works for +/- 28 days. Do not try to type this field yourself! If you just wanted this field, you should download the document containing it. However, it will not give you a reliable date 30 days out. Download the tutorial from Date Calculation Tutorial. It is a Word document. Find the field you need and copy it into your document. Then modify the field to meet your needs. You can also find it on Graham Mayor's site here: DateCalc.zip. |
#3
|
|||
|
|||
Cross-posted at: http://windowssecrets.com/forums/sho...30-Office-2007
This is the first place of posting. Responses should be posted here. Second cross-post at http://www.utteraccess.com/forum/ind...wtopic=2039748 on October 6. Third cross-posting on October 10, four days after this post, without notice here: https://social.technet.microsoft.com...eld?forum=word For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184 Last edited by Charles Kenyon; 10-11-2016 at 06:32 PM. Reason: add notes about second and third cross-postings |
#4
|
||||
|
||||
Note with the DateCalc.Zip document that if you are using US format dates you must refer to the preface and address the issue discussed there or the dates will be wrong.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
Yes, the introductory material is crucial.
|
#6
|
|||
|
|||
I was looking over the DateCalc V2_86.doc, but didn't find a working date add example.
Last edited by Charles Kenyon; 10-09-2016 at 02:42 PM. |
#7
|
|||
|
|||
Quote:
Calculate a day, date, month and year, using n days delay. Again for US formatted dates you need to run a macro. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word Field Code Displays Prior Month | jadenmyboy | Word | 1 | 09-01-2015 12:29 PM |
Create Date Field: M _____, Y | Words | Word | 3 | 12-23-2014 11:44 PM |
To Do List Report (Project 2007) Displays Completed Tasks | SusanK | Project | 5 | 04-23-2014 07:12 AM |
Date field inserting merge date in blank field | Lesley | Mail Merge | 5 | 09-30-2013 01:49 AM |
Logo displays upside down in Word 2007 | staggear | Drawing and Graphics | 1 | 04-12-2011 02:21 PM |