I receive files from a customer, which are pipe (|) delimited (as required by my specification) but this particular customer's file names end with ".csv" (in fact they are like: "order1.txt.csv").
I have written code to import the file into a workbook, using the pipe symbol as the delimiter, but when the code is run, Excel just assumes that it should be comma seperated, and puts everything on one line into one cell.
Does anyone know how I can import a file with a ".csv" extension, overriding the default behaviour ?
The file format looks like this:
12345|2| |
67890|5| |
I want each field in a seperate cell, and the pipes removed.
My code looks like this:
I would be grateful for any suggestions.
I have written code to import the file into a workbook, using the pipe symbol as the delimiter, but when the code is run, Excel just assumes that it should be comma seperated, and puts everything on one line into one cell.
Does anyone know how I can import a file with a ".csv" extension, overriding the default behaviour ?
The file format looks like this:
12345|2| |
67890|5| |
I want each field in a seperate cell, and the pipes removed.
My code looks like this:
Code:
Workbooks.OpenText fileName:=fName, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, _
textqualifier:=xlTextQualifierNone, comma:=False, _
Other:=True, OtherChar:="|", FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2))