I have a CSV file filename.csv
with the following content:
UID;Datum;Klasse;SendungsNr
6177;14.08.20;624;00340434299338038179
6178;14.08.20;624;00340434299338038186
6179;14.08.20;624;00340434299338038193
As far as I understand (here, here, here for the MS reference, etc. ...) this should import the file an insert the data into different columns:
Public Sub OpenCsvFile()
filepath = "C:\folder 1\folder 2\filename.csv"
Workbooks.OpenText Filename:=filepath, DataType:=xlDelimited, Semicolon:=True
End Sub
But it doesn't (see "update" below - seems to be a problem with the filename), it just uses the A column:
I tried specifying it over the other flag but the result stays the same:
Workbooks.OpenText Filename:=filepath, DataType:=xlDelimited, Other:=True, OtherChar:=";"
Since this can not be that difficult, I guess I'm just "blind" today, where's the problem?
Update: I found out that changing ".csv" to ".txt" seems to do the trick: it opens it into separate columns. Is that a bug or the desired behavior? Did I overlook anything in the MS reference? Now the question is, how do I get it to work without renaming the files (if it can be done at all)?
Update2: The solution, for whatever reason is to use Local:=True
as a parameter (see the second link in the duplication notice, and some info is here as well). Why this has anything to do with the file suffix I can not fathom.