Microsoft KB Archive/249033

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 17:14, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base

Programmatically Exporting Text File Truncates Dates

Article ID: 249033

Article Last Modified on 10/10/2006


  • Microsoft Excel 95 Standard Edition, when used with:
    • Microsoft Windows NT 4.0

This article was previously published under Q249033


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.


This behavior occurs when the following conditions are true:

  • You use the SaveAs method to save the contents of your Excel worksheet.


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

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


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


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

Additional query words: XL7 y2k XL95 XL7

Keywords: kbdtacode kbprb KB249033