XL97: Programmatically Exporting Text File Truncates Dates

Article translations Article translations
Article ID: 247801 - View products that this article applies to.
This article was previously published under Q247801
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

SYMPTOMS

When you programmatically save the contents of your Microsoft Excel worksheet, some dates that are stored with a four-digit year are truncated to two-digit years.

CAUSE

This behavior occurs when the following conditions are true:
  • You use the SaveAs method to save the contents of your Excel worksheet.

    -and-

  • You specify one of the following parameters for the FileFormat argument of the SaveAs method:

    • xlCSV
    • xlCSVMac
    • xlCSVMSDOS
    • xlCSVWindows
    • xlCurrentPlatformText
    • xlDIF
    • xlTextMac
    • xlTextMSDOS
    • xlTextPrinter
    • xlTextWindows

    -and-

  • The Short date style setting under Regional Settings in Control Panel is set to a format displaying four-digit years.
By design, Excel uses the default Short date style setting (m/d/yy) for the U.S. English version of Windows to determine the format for exporting your worksheet to one of the file formats listed above. This maintains consistent, predictable automation results, regardless of locale settings.

RESOLUTION

To correct this problem, download and install the latest update for Excel 97. The latest update includes this and all other Excel-specific updates that have been released since the latest service release (SR) of Office. The files included in this update will be included in any later SR or patch. To upgrade to the latest patch or for more information about the history of Excel 97 patches, please click the article number below to view the article in the Microsoft Knowledge Base:
232652 XL97: Overview and History of Excel Patches

MORE INFORMATION

Cells that contain custom formatting are not affected by this behavior.

Properties

Article ID: 247801 - Last Review: February 28, 2014 - Revision: 1.4
APPLIES TO
  • Microsoft Excel 97 Standard Edition, when used with:
    • Microsoft Windows NT 4.0
Keywords: 
kbnosurvey kbarchive kbhotfixserver kbqfe kbdtacode kbprb KB247801

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com