#1
|
|||
|
|||
Advanced field coding, given date instead of today.
I have this field code that works fine:
Code:
{ SET xM{ = { DOCVARIABLE dt1 \@ M}} }{ SET xMM{ = { DOCVARIABLE dt1 \@ MM}} }{ SET xY{ = { DOCVARIABLE dt1 \@ yyyy}} } { QUOTE { SET Delay 1 } { SET m { =MOD({ xMM }+Delay+11;12)+1 } }{ SET y { =INT({ xY }+(Delay+{ xM }-1)/12) } } “{ m }-{ y }” \@ “MMMM/yyyy” } I tried this: Code:
{ SET xDate{={ QUOTE { SET Delay 1 } { SET m { =MOD({ xMM }+Delay+11;12)+1 } }{ SET y { =INT({ xY }+(Delay+{ xM }-1)/12) } } “{ m }-{ y }” \@ “MMMM/yyyy” }}} { xDate \@ “MMMM/yyyy” } Thanks in advance Last edited by eduzs; 04-04-2020 at 05:58 PM. |
#2
|
||||
|
||||
Instead of:
{ SET xDate{={ QUOTE { SET Delay 1 } { SET m { =MOD({ xMM }+Delay+11;12)+1 } }{ SET y { =INT({ xY }+(Delay+{ xM }-1)/12) } } “{ m }-{ y }” \@ “MMMM/yyyy” }}} { xDate \@ “MMMM/yyyy” } use: {SET xDate{QUOTE{SET Delay 1}{SET m{=MOD({xMM}+Delay+11;12)+1 }}{SET y{=INT({ xY }+(Delay+{ xM }-1)/12)}} "{ m }-{ y }" \@ "MMMM/yyyy"}} {REF xDate } That said, it would be far simpler just to bookmark the first output then cross-reference that bookmark.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks macropod! Works fine!
I found that the second line works with or without "REF". Also thanks for "WORD Date & Time Manipulation: Tips & Techniques" which helped a lot. |
#4
|
||||
|
||||
True, but cross-references - which is what you are using - should nevertheless be prefixed with REF. In any event, if you bookmark the result (whether via the SET field or by bookmarking the output) and cross-reference it via Insert|Cross-Reference, Word will always insert the REF part.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change font color if date in column F is prior to today's date. | kevinbradley57 | Excel Programming | 1 | 12-05-2018 07:35 PM |
Nested If Statements in Formula Field to Produce the Diffrnc in Years Between Today's & Entered Date | mshu31 | Word | 1 | 02-09-2017 02:04 PM |
Today's Date Function | freschij | Excel | 3 | 02-11-2011 10:21 AM |
new appointment date always reverts back to today's date | msills | Outlook | 0 | 08-24-2007 08:57 AM |
Imported message date change to today's date | promark | Outlook | 1 | 12-23-2005 07:21 AM |