title: Open CSV file via VBA (performance)
body: <p>Obviously, this question has been asked many times. The normal procedure: </p>
  
  <p><code>Workbooks.Open (ActiveWorkbook.Path &amp; "\Test.csv")</code></p>
  
  <p>won't parse the CSV correctly (having many rows in one cell)</p>
  
  <p>Thanks to Lernkurve, I can use his function to get it right: <a href="https://stackoverflow.com/questions/553888/opening-semicolon-delimited-csv-file-with-vba-in-excel-2000">Opening semicolon delimited CSV file</a></p>
  
  <pre><code>Sub ImportCSVFile(filepath As String)
  Dim line As String
  Dim arrayOfElements
  Dim linenumber As Integer
  Dim elementnumber As Integer
  Dim element As Variant
  
  linenumber = 0
  elementnumber = 0
  
  Open filepath For Input As #1 ' Open file for input
      Do While Not EOF(1) ' Loop until end of file
          linenumber = linenumber + 1
          Line Input #1, line
          arrayOfElements = Split(line, ";")
  
          elementnumber = 0
          For Each element In arrayOfElements
              elementnumber = elementnumber + 1
              Cells(linenumber, elementnumber).Value = element
          Next
      Loop
  Close #1 ' Close file.
  End Sub
  </code></pre>
  
  <p>This however is not fast (I have files with thousands of columns) and my question is:</p>
  
  <p>Is there any native way to open CSV files in Excel with right parsing?</p>