Microsoft KB Archive/123197

{|
 * width="100%"|

XL5: FoxPro Dates Exported to Microsoft Excel as Text

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c
 * Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a

-

SYMPTOMS
When you export a FoxPro database containing a DATE field to Microsoft Excel by using the Copy To dialog box, the dates are formatted as text when you open the file in Microsoft Excel.

CAUSE
This behavior is by design of Microsoft FoxPro. When you use the Copy To feature in Microsoft FoxPro to copy your data to a Microsoft Excel file, the data in the .DBF file is exported as unformatted text strings.

WORKAROUNDS
To correct this problem, do the following in Microsoft Excel 5.0:

NOTE: These steps assume that cell A2 contains the date and that cells B2 and C2 are empty.


 * 1) In cell B2, type "=DATEVALUE(A2)" (without the quotation marks), and then press ENTER.
 * 2) Select cell B2 again. From the Edit menu, choose Copy.
 * 3) Select cell C2. From the Edit menu, choose Paste Special.
 * 4) In the Paste Special dialog box, under Paste, select the Values option, and then choose OK.

You can now use the Format Cells dialog box to format the date value with the desired date format.

To avoid this behavior, export the Microsoft FoxPro data using the Table (DBF) file format instead of the Microsoft Excel format.

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

"Q101288 PRB: FoxPro Dates Exported to Microsoft Excel as Characters"