Share via

Field Codes

Anonymous
2022-01-28T22:47:33+00:00

I want to format my dates on Microsoft Word as such: sixth (6). How do I achieve this in programming the field code. Microsoft doesn't have advanced tutorials on this or I haven't looked hard enough. I tried the date as "ddd", which gives me 'Friday,' and "d", which gives me '6' but cant seem to get this numchar to be sixth, in the roman numeral format. I'm doing this for a court related document!

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Charles Kenyon 167.1K Reputation points Volunteer Moderator
2022-01-29T00:44:46+00:00

For more on formatting date fields, see my page: Using Date Fields in Microsoft Word

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Jay Freedman 207.6K Reputation points Volunteer Moderator
2022-01-29T00:39:35+00:00

A good reference for switches used to format various kinds of fields is https://www.gmayor.com/formatting_word_fields.htm . The topic of this thread is discussed there under the heading "Date fields with ordinals".

If you use \* ordtext instead of \* ordinal, the number will be spelled out.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author

John Korchok 232.4K Reputation points Volunteer Moderator
2022-01-29T00:18:42+00:00

Word can't do spelled ordinal numbers, but it can do numeric ones like 6th. The ordinal will have to be in its own field. Here are the steps:

  1. Choose Insert>Quick Parts>Field, set Categories to Date and Time, and choose your preferred date field type from the 5 available choices.
  2. Click on the Date formats field and type d.
  3. Click on the Field Code button. Your chosen date format is added to the field.
  4. Click inside the Field codes field. The insertion point should be flashing after a space following the existing field code.
  5. Type *\ordinal
  6. Click on OK.
  7. A numeric ordinal field is displayed, like 28th.
  8. Build other date fields around this one to create the complete date format.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Jay Freedman 207.6K Reputation points Volunteer Moderator
    2022-01-29T22:19:08+00:00

    Yes, you can write field codes directly on the document, and the result will be displayed when you update the field.

    If you're starting with an existing field, right-click it and choose "Toggle Field Codes" in the menu, or select the field result and press Shift+F9 (or, on some laptops, Fn+Shift+F9). Either method will display the field's code, and you can type whatever you need to change it. When you finish, press F9 (or Fn+F9) to update the field and display the result.

    If you're making a new field, start by pressing Ctrl+F9 (or Fn+Ctrl+F9) to insert the field brackets at the cursor position. You won't get a real field if you just type the brackets on the keyboard; you must use Ctrl+F9 if you aren't using the Field dialog. Then you can type the field code, starting with the keyword that determines what kind of field it is, and adding the other parts as needed. Again, press F9 to update and display the result.

    You can find the syntax of the codes and the switches they support by going to List of Field Codes in Word and clicking on the link to the desired field type. There are some other switches that apply to most kinds of fields; those are discussed in the page https://www.gmayor.com/formatting_word_fields.htm that I cited before.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Doug Robbins - MVP - Office Apps and Services 323K Reputation points MVP Volunteer Moderator
    2022-01-29T06:09:59+00:00

    The term "compiler" is not really applicable to a Word document in the same sense as it is to Visual Basic or other code.

    What exactly do you mean? Can you give an example of the code that you want to write and how you expect it to be "compiled"?

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments