Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open csv file delimited by pipe character "|" or not common delimiter

I'm trying to set up an Excel VBA code that opens up some .csv files and split into columns the information contained and delimited by the character |. I manage to open the file but the code I use opens my files without splitting the text according to the delimiter. So far I have tried the following code:

Sub OpenCSV()

Dim wkbTemp As Workbook
Dim sPath As String, sName As String

sPath = ThisWorkbook.Path & "\CSV_Files\"
sName = "Test.csv"

Set wkbTemp = Workbooks.Open(Filename:=sPath & sName, Format:=6, Delimiter:="|")

End Sub
like image 417
Ali Gröch Avatar asked Jul 24 '13 11:07

Ali Gröch


1 Answers

I remember this has driven me insane some time back.
It seems that Excel has an uncontrolled greed for .csv files. If you just change the ending (.txt, .dat or whatever), it will work!

like image 107
KekuSemau Avatar answered Nov 18 '22 21:11

KekuSemau