Hi,
Im trying to use an excel object to open a file thats delimited by the vertical bar - "|". But when I set the delimiter to "|" in the Open command, the file isn't delimited.
Here is a bit of the code...
----------------------------------------------
Dim excel_app As Excel.Application
Dim work_book As Excel.Workbook
Dim excel_file As String
Dim val As String
Set excel_app = New Excel.Application
excel_file = "c:\file.txt"
Set work_book = excel_app.Workbooks.Open(excel_file, , , , , , , , "|"
val = work_book.ActiveSheet.Cells(1, 1).Value
----------------------------------------------
When I print the val, I get the whole line "A|B|C|D|E|F..." instead of "A".
I tried using this code for tab delimited file and that seems to work. Anyone have any idea how I can set the workbook so that each cell contains the delimited values instead of the first cell containing the whole line?
Thanks in advance.
G. Rush
Im trying to use an excel object to open a file thats delimited by the vertical bar - "|". But when I set the delimiter to "|" in the Open command, the file isn't delimited.
Here is a bit of the code...
----------------------------------------------
Dim excel_app As Excel.Application
Dim work_book As Excel.Workbook
Dim excel_file As String
Dim val As String
Set excel_app = New Excel.Application
excel_file = "c:\file.txt"
Set work_book = excel_app.Workbooks.Open(excel_file, , , , , , , , "|"
val = work_book.ActiveSheet.Cells(1, 1).Value
----------------------------------------------
When I print the val, I get the whole line "A|B|C|D|E|F..." instead of "A".
I tried using this code for tab delimited file and that seems to work. Anyone have any idea how I can set the workbook so that each cell contains the delimited values instead of the first cell containing the whole line?
Thanks in advance.
G. Rush