Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2016, 12:55 PM
Papote Papote is offline Create Field That Displays Date+30, Office 2007 Windows 10 Create Field That Displays Date+30, Office 2007 Office 2013
Novice
Create Field That Displays Date+30, Office 2007
 
Join Date: Oct 2016
Posts: 2
Papote is on a distinguished road
Default 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" }" } } } }" }

Reply With Quote
  #2  
Old 10-06-2016, 02:32 PM
Charles Kenyon Charles Kenyon is offline Create Field That Displays Date+30, Office 2007 Windows 8 Create Field That Displays Date+30, Office 2007 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

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.

Reply With Quote
  #3  
Old 10-06-2016, 06:38 PM
Charles Kenyon Charles Kenyon is offline Create Field That Displays Date+30, Office 2007 Windows 8 Create Field That Displays Date+30, Office 2007 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

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
Reply With Quote
  #4  
Old 10-06-2016, 09:13 PM
gmayor's Avatar
gmayor gmayor is offline Create Field That Displays Date+30, Office 2007 Windows 10 Create Field That Displays Date+30, Office 2007 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #5  
Old 10-07-2016, 05:08 AM
Charles Kenyon Charles Kenyon is offline Create Field That Displays Date+30, Office 2007 Windows 8 Create Field That Displays Date+30, Office 2007 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by gmayor View Post
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.
Yes, the introductory material is crucial.
Reply With Quote
  #6  
Old 10-07-2016, 11:04 AM
Papote Papote is offline Create Field That Displays Date+30, Office 2007 Windows 10 Create Field That Displays Date+30, Office 2007 Office 2013
Novice
Create Field That Displays Date+30, Office 2007
 
Join Date: Oct 2016
Posts: 2
Papote is on a distinguished road
Default

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.
Reply With Quote
  #7  
Old 10-09-2016, 02:47 PM
Charles Kenyon Charles Kenyon is offline Create Field That Displays Date+30, Office 2007 Windows 8 Create Field That Displays Date+30, Office 2007 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by Papote View Post
I was looking over the DateCalc V2_86.doc, but didn't find a working date add example.
Look at page 7.
Calculate a day, date, month and year, using n days delay. Again for US formatted dates you need to run a macro.
Reply With Quote
Reply

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
Create Field That Displays Date+30, Office 2007 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
Create Field That Displays Date+30, Office 2007 Logo displays upside down in Word 2007 staggear Drawing and Graphics 1 04-12-2011 02:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft