WD6X: Date Toolbar Button Inserts Incorrect Date Format

ID: Q108404

The information in this article applies to:

IMPORTANT: This article contains information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information about how to do this, click Help in Registry Editor, click the Contents tab, and click to view the "Restoring the Registry" topic.

SYMPTOMS

If you click the Date button on the Header And Footer toolbar, Microsoft Word may insert a date format that is different from the one you set using the DATEFORMAT switch in the [Microsoft Word] section of your Winword6.ini file.

CAUSE

When you insert the date using the Date toolbar button, Word inserts a DATE field with the \L switch, which inserts the date with the last format you selected using the Date And Time command (Insert menu).

WORKAROUND

To work around this problem, use any of the following methods.

Method 1

On the Tools menu, click Macro. In the Macro Name box type "InsertDateField" (without the quotation marks) and click Create. Change the macro to read as follows:

    Sub MAIN
    InsertField .Field = "date"
    End Sub

Close and save the macro.

To specify a default date format in Word for Windows, modify the Winword6.ini file. In Word for Windows NT, modify the Windows Registry as described in the "More Information" section below.

Method 2:

After you insert the DATE field using the Date toolbar button, switch to field codes view (press ALT+F9 or SHIFT+F9) and remove the \L switch from the field. For example, change { DATE \L } to { DATE }.

Method 3:

On the Insert menu, click Date And Time. Select the format you want and then choose OK. The next time you click the Date toolbar button, Word uses the format you last selected in the Date And Time dialog box.

Method 4:

Use the following procedure to record a Macro that inserts the date format of your choice, and assign it to the Toolbar:

1. On the Tools menu, click Macro. Type a name for your macro in the Macro

   Name text box and click Record.

2. On the Insert menu, click Field. In the Categories list, click Date And
   Time, and in the Field Names list, click Date. Click Options. Click the
   General Switches tab and in the Date-Time list, click the format that
   you want. Click Add To Field, and then click OK.

3. Click OK in the Fields dialog box. Click the Stop button on the Macro
   Recorder toolbar. The macro has now been recorded.

4. On the Tools menu, click Customize. Click the Toolbar tab and in the
   Categories list, select Macros. In the Macros list, select the name of
   the macro you just recorded and drag it to an open area on the toolbar.

5. In the Custom Button dialog box, click to select a button-face and then
   click Assign. Click Close.

STATUS

Microsoft has confirmed this to be a problem in Word for Windows versions 6.0, 6.0a, and 6.0c. This problem was corrected in Word for Windows 95 version 7.0. The \L switch is no longer inserted.

MORE INFORMATION

To modify the Winword6.ini file in Word for Windows, follow these steps (see below for Word for Windows NT):

1. On the Tools menu, click Macro. In the Macro Name box, type

   "ToolsAdvancedSettings" (without the quotation marks) and click Run.

2. In the Categories list, click Microsoft Word. In the Startup Options
   list, click DateFormat. (If DateFormat does not appear, delete the
   contents of the Option box and type "DateFormat" without the quotation
   marks) Delete the contents of the Setting box and type in the default
   date format you want, for example "MMMM d, yyyy" (without the quotation
   marks). Click Set, and then click Close.

To modify the Winword6.ini file in Word for Windows NT follow these steps:

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall Windows. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the Changing Keys And Values online Help topic in Registry Editor (Regedit.exe). Note that you should understand how to restore the registry if a problem occurs after you edit it. For information about how to do this, click Help in Registry Editor, click the Contents tab, and click to view the "Restoring the Registry" topic.

1. In the Program Manager, choose Run from the File menu, and type

   "REGEDT32" (without the quotation marks) and then click OK. Open the
   HKEY_CURRENT_USER window and navigate to the following key:

      Software\Microsoft\Word\6.0\Options.

2. Select the DateFormat value. If it doesn't exist, click Add Value on
   the Edit menu, and type "DateFormat" (without the quotation marks) in
   the Value Name field. Click OK.

3. In the String field, type in the default date format you want, for
   example "MMMM d, yyyy" (without the quotation marks). Click OK then
   close the Registry Editor.

REFERENCES

"Microsoft Word User's Guide," version 6.0, Chapter 31, "Customizing and Optimizing Word," "Customizing Toolbars" section

Additional query words:

Keywords          : wordnt kbfield winword ntword macword word6 word7 word95 
Version           : MACINTOSH:6.0,6.0.1,6.0.1a;WINDOWS:6.0,6.0a,6.0c,7.0,7.0a
Platform          : MACINTOSH WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: February 7, 1998