WD: Creating Custom Date Formats with AutoText and/or Toolbar (176692)



The information in this article applies to:

  • Microsoft Word 97 for Windows
  • Microsoft Word 98 Macintosh Edition

This article was previously published under Q176692

SUMMARY

In Word, you can insert a date using the DATE field. You can add switches to the DATE field to customize the date format.

This article describes the following:

  • how to create a custom date format in Word
  • how to create an AutoText entry for a custom date format
  • how to record a custom date format macro so that you can use a toolbar button to insert the date

MORE INFORMATION

Creating a Custom Date Format in Word

To insert a date and add switches to control the date format, follow these steps:

  1. On the Insert menu, click Field. Under Categories, click the Date and Time. Under Field Names, click Date, and then click Options.
  2. Click the General Switches tab and under Date-Time, select a date format, click Add to Field, and then click OK twice.

    In the following example, the date field code

    DATE \@ "dd MMMM yyyy"

    returns:

    12 July 1997

    The "dd" switch returns "12," the "MMMM" switch returns the month July, and "yyyy" returns the year 1997.

Creating an AutoText Entry for a Custom Date Format

To store the date field as an AutoText entry, follow these steps:

  1. In your document, select the date field that you inserted using the steps in the previous section.
  2. On the Insert menu, point to AutoText, and then click New.
  3. Type a name for the AutoText Entry and then click OK.

Recording a Custom Date Macro to Insert the Date from a Toolbar Button

To record an "insert date" macro and assign it to a toolbar button, follow these steps:

  1. On the Tools menu, point to Macro, and then click Record New Macro.
  2. Under Macro Name, type in a name for your macro and then click Toolbars.
  3. Drag your macro to a toolbar and then click Close to close the Customize dialog box.
  4. On the Insert menu, click Field. Under Categories, click Date And Time.
    Under Field Names, click Date, and then click Options.
  5. Click the General Switches tab and under Date-Time, select a date format, click Add To Field, and then click OK twice.
  6. Click Stop Recording on the macro toolbar.
For more information about date field format switches, click the Office Assistant, type "switches," click Search, click "general switches", click Date-Time Picture, and then click Date Instructions.

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Word Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:

120802 Office: How to Add/Remove a Single Office Program or Component

For additional information, please see the following article in the Microsoft Knowledge Base:

160988 WD97: How to Create Ordinal (Legal) Dates in Form Fields

134910 WD: How to Set a Default Date Field Format in Word

For additional information about this situation in earlier versions of Word, please see the following article in the Microsoft Knowledge Base:

59019 WD: Creating Custom Date Formats with Glossary or AutoMac


Modification Type:MajorLast Reviewed:10/8/2003
Keywords:kbfield kbhowto KB176692