WD: Creating Custom Date Formats with AutoText or Toolbar

Last reviewed: February 18, 1998
Article ID: Q176692
The information in this article applies to:
  • Microsoft Word 97 for Windows
  • Microsoft Word 98 Macintosh Edition

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:

   ARTICLE-ID: Q120802
   TITLE     : Office: How to Add/Remove a Single Office
               Program or Component

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

   ARTICLE-ID: Q160988
   TITLE     : WD97: How to Create Ordinal (Legal) Dates in Form Fields

   ARTICLE-ID: Q134910
   TITLE     : 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:

   ARTICLE-ID: Q59019
   TITLE     : WD: Creating Custom Date Formats with Glossary or AutoMac


Additional query words: Additional query words: word97 word8
Keywords : kbfield macword98
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbhowto
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 18, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.