Date format is not correct when you convert a CSV text file in Excel 2002 by using a VBA macro (835718)
The information in this article applies to:
Important This article contains information about modifying the registry.
Before you modify the registry, make sure to back it up and make sure that you
understand how to restore the registry if a problem occurs. For information
about how to back up, restore, and edit the registry, click the following
article number to view the article in the Microsoft Knowledge Base: 256986 Description of the Microsoft Windows Registry SYMPTOMSWhen you use a Microsoft Visual Basic for Applications (VBA)
macro to convert a Comma-Separated Values (CSV) text file into a Microsoft
Excel 2002 workbook (*.xls), the format of dates that are converted into your
Excel 2002 workbook may not be correct. For example, in your CSV file,
dates may be in the format of: When you run the following macro to convert your CSV text file
into Excel, dates may be converted in the following mm/dd/yyyy format:
Sub test()
Workbooks.OpenText Filename:="C:\Test1.csv", DataType:=xlDelimited, _
TextQualifier:=xlTextQualifierNone, FieldInfo:=Array(1, 4)
End Sub
RESOLUTIONHow to obtain the hotfixThis issue is fixed in the Excel 2002 Hotfix Package . For
additional information, click the following article number to view the article
in the Microsoft Knowledge Base: 829348 Excel 2002 post-Service Pack 3 hotfix package: May 6, 2004 After you install this hotfix, follow the
steps that are listed in the "More Information" section of this article to set
the VBAAlwaysLoadUS registry key and to activate the
hotfix. WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To work around this problem, add the <local:=true> parameter to your VBA macro as in the following example:
Sub test()
Workbooks.OpenText Filename:="C:\Test1.csv", DataType:=xlDelimited, _
TextQualifier:=xlTextQualifierNone, FieldInfo:=Array(1, 4), Local:=True
End Sub
STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
in the "Applies to" section of this article.
Modification Type: | Minor | Last Reviewed: | 4/7/2006 |
---|
Keywords: | kbOfficeXPpostSP3fix kbfix kbbug kbQFE KB835718 kbAudEndUser kbAudDeveloper |
---|
|