Not the cleanest code in the world but I think you will get the idea...
Imports Excel = Microsoft.Office.Interop.Excel
Imports System.IO
Imports Microsoft.VisualBasic
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop.Excel.XlColumnDataType
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xlApp As Excel.Application
Dim xlWorkbook As Excel.Workbook
Dim xlWorksheet As Excel.Worksheet
Dim myStr As String
Dim FileReader As StreamReader
Dim FileWriter As StreamWriter
Dim results As DialogResult
Dim openFileDialog1 As New OpenFileDialog()
Dim mycol(,) As Object = New Object(,) {{1, 2}, {2, 2}, {3, 5}, {4, 1}, {5, 2}, {6, 1}}
openFileDialog1.InitialDirectory = "c:\"
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
openFileDialog1.FilterIndex = 2
openFileDialog1.RestoreDirectory = True
results = openFileDialog1.ShowDialog
If results = DialogResult.OK Then
FileReader = New StreamReader(openFileDialog1.FileName)
myStr = FileReader.ReadToEnd()
'myStr = Replace(myStr, "'", "")
FileWriter = New StreamWriter("c:\Temp\invoices.txt")
FileWriter.Write(myStr)
FileWriter.Close()
FileReader.Close()
xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
xlApp.Workbooks.OpenText("C:\Temp\invoices.txt", , , , XlTextQualifier.xlTextQualifierSingleQuote, True, FieldInfo:=mycol)
xlWorkbook = xlApp.ActiveWorkbook
xlWorksheet = xlWorkbook.Worksheets("invoices")
MsgBox(xlWorksheet.Cells(2, 1).value)
xlWorkbook.SaveAs("c:\Temp\invoices.xlsx", FileFormat:=51)
xlWorkbook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkbook)
releaseObject(xlWorksheet)
End If
End Sub