How does one open a semicolon delimited CSV file with VBA in Excel 2000?
In Excel 2003 11.8231.8221 SP3 with VBA 6.5.1025, I can open a semicolon delimited file with the following VBA code:
Workbooks.OpenText filename:=myFilename, _
DataType:=xlDelimited, Semicolon:=True, Local:=True
However, when the same code is run in Excel 2000 9.0.8961 SP1 with VBA 6.5.1025, I get the following error:
Compile error: Named argument not found
That is --I think-- because Excel 2000 doesn't know the named argument "Local".
Therefore, I deleted the "Local:=True" part. But the problem then is that an entire line from the CSV file is written into one cell instead of being split up into the separate semicolon delimited parts.
I have searched the Internet for a solution, but did not find anything useful and concise.
Any ideas?
[Update 17.02.2009]
I tried the suggestion from user lc with the macro recorder. However, the results were confusing.
When I open the CSV file with menu File->Open... and then select the CSV file, the semicolon separated data is correctly parsed. And the recorded code is as simple as:
Workbooks.Open filename:= _
"D:\testdata\Example 01 CSV\input.csv"
But when I use that VBA code in my macro, each line ends up in one cell again.
According to the suggestion from user barrowc, I also changed the The Windows "Regional and Language Options" settings from "German (Switzerland)" to "English (United States)". Even after restarting Excel, nothing changed, same problem.
I wonder why it is working on user Remou's system. What regional and language settings do you have?