title: How to write in CSV file using VB6
body: <p>How can I write per column in <code>.csv</code> file using <code>VB6</code>? I use <code>File System Object</code> <code>.writeline</code> to <strong>read and write</strong> in .csv file but my problem is it only write in <strong>one column only</strong>. Can someone please help me.</p>
  
  <pre><code>Dim fso As New FileSystemObject
  Dim fsoStream As TextStream
  
  Set fsoStream = fso.CreateTextFile("C:\Users\Users\Desktop\File\Sample.csv", True)
  
  fsoStream.WriteLine "Like This is what I have tried" 'this must be written in the first column
  fsoStream.WriteLine "But this is a sample only" 'this must be written in the first column
  fsoStream.WriteLine "Sample 1" 'this must be written in the second column
  fsoStream.WriteLine "Sample 1" 'this must be written in the second column
  fsoStream.WriteLine "Sample 2" 'this must be written in the third column
  fsoStream.WriteLine "Sample 2" 'this must be written in the third column
  
  fsoStream.Close
  Set fsoStream = Nothing
  Set fso = Nothing
  </code></pre>
  
  <p><strong>This picture must be the output.</strong></p>
  
  <p><img src="https://i.stack.imgur.com/u4H4Z.jpg" alt="enter image description here"></p>
  
  <p><strong>but this is what I have got in using the code above</strong>
  <img src="https://i.stack.imgur.com/iurWe.jpg" alt="enter image description here"></p>