Microsoft KB Archive/108404

{|
 * width="100%"|

WD6X: Date Toolbar Button Inserts Incorrect Date Format

 * }

Q108404

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
 * Microsoft Word for the Macintosh, version 6.0
 * Microsoft Word for Windows NT, version 6.0

-

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 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 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. 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.

  In the Program Manager, choose Run from the File menu, and type REGEDT32 and then click OK. Open the HKEY_CURRENT_USER window and navigate to the following key: "Software\Microsoft\Word\6.0\Options." Select the DateFormat value. If it doesn't exist, click Add Value on the Edit menu, and type DateFormat in the Value Name field. Click OK. In the String field, type in the default date format you want, for example MMMM d, yyyy. Click OK then close the Registry Editor.