0

Having 1{sup|er} janvier 2012 for the MergeField Microsoft Word for Email.

The format that we have is fmDD"{sup|er}" month YYYY

This is the format that we currently use and wondering if there is a way for this to be corrected in the Word file

{MERGEFIELD theDate} We use this on the Microsoft Word file but it didn't work. The result is at it is 1{sup|er} janvier 2012.

The Expected behavior is 1er janvier 2012 for the Microsft Word.

Thanks in advance.

Aizen
  • 1,807
  • 2
  • 14
  • 28
  • See http://www.vbaexpress.com/forum/showthread.php?70336-Macro-to-superscript-ordinal-date-numbers-%93st%94-%93nd%94-%93rd%94-%93th%94. Look also at my Add-In which includes ordinal dates. https://addbalance.com/word/download.htm#LegalToolbars. The macro would be run on a final merge result document. See also my page on Date Fields and their formatting: https://addbalance.com/word/datefields1.htm#PageStart – Charles Kenyon Aug 04 '23 at 15:02

2 Answers2

0

From my page on Date Fields in Microsoft Word is the following field structure.

{QUOTE{CREATEDATE @ "dddd 'the' d"}{IF{=(MOD({={CREATEDATE @ d}+89},100)>2)*(MOD({={CREATEDATE @ d}+9},10)<3)}= 1 {=MOD({CREATEDATE @ d},10)-2 # rd;st;nd} th}{CREATEDATE @ "' of' MMMM, yyyy"}}

Here is a screenshot of the field which shows the superscripting:

screenshot of field code

This field is from my Legal Toolbars Add-In as a superscripted CreateDate. It is an AutoText entry there. Here is a screenshot from the Add-In menu.

screenshot from Add-In

You could try to modify it to use your mergefield instead of CREATEDATE. This is based on work by Paul Edstein (aka macropod).

{QUOTE{MERGEFIELD theDate \@ "dddd 'the' d"}{IF{=(MOD({={MERGEFIELD theDate \@ d}+89},100)>2)*(MOD({={MERGEFIELD theDate \@ d}+9},10)<3)}= 1 {=MOD({v \@ d},10)-2 \# rd;st;nd} th}{MERGEFIELD theDate \@ "' of' MMMM, yyyy"}}

(I have not tried this with a merge field. You would need to superscript parts as shown in the screenshot.)

Refer to my page on date fields for more. You cannot simply type the braces. Word must insert them. See also: my article on Dealing with Fields in Word.

Charles Kenyon
  • 869
  • 1
  • 8
  • 19
0

It looks as if you hoped that Word's "field language" would be similar to something you are familiar with. But for example {sup|er} doesn't mean anything in Word's "field language".

To make this work for dates in the French language, I suggest you start by experimenting with the following fields and formatting.

{SET xDate {MERGEFIELD theDate}}{SET ordText {={xDate \@D}-2 \#e;er}}{xDate \@D}{ordText}{xDate \@" MMMM YYYY"}

All the {} need to be the special field code braces that you can insert on the Windows Desktop version of Word using ctrl-F9.

Then, select the field {ordText} and format it as superscripted text.

I may well have got some details wrong. But if you need this to work in languages other than French, you would have to ensure that you mapped each date in the month to the appropriate ordinal text, e.g. in English, the 1st, 21st and 3st should have "st", the 11th needs "th" and so on, whereas in French the 1st needs "er" and everything else needs "e"

jonsson
  • 655
  • 1
  • 3
  • 10