Note that there are some explanatory texts on larger screens.

plurals
  1. POOpening semicolon delimited CSV file
    text
    copied!<p>How does one open a semicolon delimited CSV file with VBA in Excel 2000?</p> <p><strong>Sample data</strong></p> <pre><code>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 </code></pre> <p><strong>Code</strong></p> <p>In Excel <strong>2003</strong> 11.8231.8221 SP3 with VBA 6.5.1025, I can open a semicolon delimited file with the following VBA code:</p> <pre><code>Workbooks.OpenText filename:=myFilename, _ DataType:=xlDelimited, Semicolon:=True, Local:=True </code></pre> <p>However, when the same code is run in Excel <strong>2000</strong> 9.0.8961 SP1 with VBA 6.5.1025, I get the following error:</p> <blockquote> <p>Compile error: Named argument not found</p> </blockquote> <p>That is --I think-- because Excel 2000 doesn't know the named argument "Local".</p> <p>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.</p> <p>I have searched the Internet for a solution, but did not find anything useful and concise.</p> <p>Any ideas?</p> <p><strong>[Update 17.02.2009]</strong></p> <p>I tried the suggestion from <em><a href="https://stackoverflow.com/users/44853/lc">user lc</a></em> with the macro recorder. However, the results were confusing.</p> <p>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:</p> <pre><code>Workbooks.Open filename:= _ "D:\testdata\Example 01 CSV\input.csv" </code></pre> <p>But when I use that VBA code in my macro, each line ends up in one cell again.</p> <p>According to the suggestion from <em><a href="https://stackoverflow.com/users/53614/barrowc">user barrowc</a></em>, 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.</p> <p>I wonder why it is working on <em><a href="https://stackoverflow.com/users/2548/remou">user Remou</a></em>'s system. What regional and language settings do you have?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload