I'm obviously missing something here.
Basically I'm writing a program that will read in a csv file or excel file, and allows the user to pick which fields thay wish to use for what line of an address, and then import all the addresses to a SQL table for later processing.
I got the excel import working by opening it through ODBC as a database and reading it in and I thought that I'd save time by just converting the csv to excel and reusing the Excel routine on my new Excel file but I'm having difficulty with the csv conversion.
Here is what I'm using:
private sub ConvertCSV(OldName, NewName) Try XL = New Excel.Application XL.Visible = False XL.Workbooks.OpenText(OldName) XL.DisplayAlerts = False XL.ActiveWorkbook.SaveAs(NewName, Excel.XlFileFormat.xlExcel9795, , , , False) XL.ActiveWorkbook.Close(False) XL.Quit() XL = Nothing Catch ex As Exception sError = ex.ToString ' Returns error details MsgBox(sError, MsgBoxStyle.OkOnly) Debug.WriteLine(ex.ToString) End Try end sub
The trouble is that when it then goes into my Excel Address routine, the new excel file appears to be empty.
I see an excel file outputted to where I want it on the computer but it will not open for me (no errors given excel just hangs)
Any ideas or will I have to parse the CSV file line by line into Excel?
Edited 7 Years Ago by G_Waddell: n/a