title: Reading data from text file and delimiting
body: <p>I have an Excel 2010 spreadsheet, and I am reading in information from a .txt file (and another .xls file in future).</p>
  
  <p>This text file has 3 elements per row; firtname, surname and Job title, and each element is separated by a comma. I have the data reading and pasting into Excel, however each row is pasted into the one cell. I am looking to paste each element into different columns. I know that I should try and delimit, but I just can't figure out the syntax.</p>
  
  <p>My question is how do I separate each element and paste it into it's own cell? I currently use commas to separate each element on my .txt file, but future files might use tabs, full-stops, semi-colons etc. How do I extend it so all bases are covered?</p>
  
  <p>Below is my code, and under my code is a sample of dummy data</p>
  
  <pre><code>Sub FetchDataFromTextFile()
      Dim i As Long
      Dim LineText As String
      Open "C:\mytxtfile.txt" For Input As #24
      i = 2
      While Not EOF(24)
          Line Input #24, LineText
          ActiveSheet.Cells(i, 2).Value = LineText
          P = Split(Record, ",")
          i = i + 1
      Wend
      Close #24
  End Sub
  </code></pre>
  
  <p>John, Doe, Boss</p>
  
  <p>Johnny, Steele, Manager</p>
  
  <p>Jane, Smith, Employee</p>
  
  <p>NOTE: Competant in other programming languages, however not done VB in about 6 or 7 years. I can never seem to wrap my head around VB Syntax, so please treat me like a novice for this. </p>