How to open CSV file with semicolon using VBA in Excel 2000?
Data examples
An ID;TEST20090222 A Name;Firstname Surname A Date;11.05.2000 Country:;SomeCountryName Currency;EUR CostA; CostB; CostC; Part1;10;20;30 Part2;;;; Part3;34;56;87
the code
In Excel 2003 11.8231.8221 SP3 with VBA 6.5.1025, I can open a comma delimited file with the following VBA code:
Workbooks.OpenText filename:=myFilename, _ DataType:=xlDelimited, Semicolon:=True, Local:=True
However, when the same code runs in Excel 2000 9.0.8961 SP1 with VBA 6.5.1025, I get the following error:
Compilation Error: Named argument not found
That is - I think ... because Excel 2000 does not know the named argument "Local".
So I removed the "Local: = True" part. But then the problem is that the whole line from the CSV file is written in one cell, and not split into separate parts with a comma.
I searched the Internet for a solution, but did not find anything useful and concise.
Any ideas?
[Update 02.17.2009]
I tried the user lc suggestion with a macro recorder. However, the results were incomprehensible.
When I open a CSV file with the menu File-> Open ... and then select a CSV file, the data separated by a semicolon is correctly parsed. And the written code is as simple as:
Workbooks.Open filename:= _ "D:\testdata\Example 01 CSV\input.csv"
But when I use this VBA code in my macro, each line again falls into one cell.
As suggested by user barrowc , I also changed the Windows Regional and Language Settings from German (Switzerland) to English (United States). Even after restarting Excel, nothing has changed, the same problem.
I wonder why he is working on the Remou user system . What regional and language settings do you have?