title: Visual Basic .NET: Open Tab Delimited Text File in Excel
body: <p>I'm working to upgrade a legacy app. This app generates a .txt file that is tab delimited and in the final action converts this file to a .xlsx file &amp; saves it. This code correctly opens in Excel (data split in columns by the tab delimiter) when built on VB6 but on Visual Basic .NET it looks like Excel is defaulting to use comma as the delimiter, meaning the data is all in the first column. I need to override that attribute to force it to delimit by vbTab. How can I accomplish this?</p>
  
  <p>Sample text File</p>
  
  <pre><code>Respondent Id   Starting Date   Starting Time   Completed Date  Completed Time
  0000140 12/21/19    20:18:01    12/21/19    20:31:28
  0000141 12/21/19    21:11:56    12/21/19    21:14:53
  0000142 12/21/19    22:46:11    12/21/19    22:56:24
  0000144 12/26/19    15:28:44    12/28/19    22:12:18
  0000145 12/26/19    22:27:51    12/27/19    16:48:15
  0000146 12/27/19    10:01:42    12/27/19    10:05:06
  0000147 12/27/19    10:21:47    12/27/19    10:32:01
  0000148 12/27/19    13:01:21    12/27/19    13:09:00
  0000149 12/27/19    13:09:19    12/27/19    13:11:51
  </code></pre>
  
  <p>And my VB.NET code. There's really not much to this...</p>
  
  <pre><code>' Create excel object
  Dim oExcel = CreateObject("Excel.Application")
  
  ' Open the text file that was generated. Generated_Text_File is generated file that is tab delimited
  Dim oBook = oExcel.Workbooks.Open(Generated_Text_File)
  
  oBook.SaveAs(Excel_FilePath, FileFormat:=51)
  
  </code></pre>