I have a problem with opening .csv files with Excel by VBA code. I have data organised like:
Number;Name;Price1;Price2;City
1234;"John Smith";"1,75 EUR";"2,15 EUR";"New Mexico"
3456;"Andy Jahnson";"12,45 EUR";"15,20 EUR";London
3456;"James Bond";"42,34 EUR";"9,20 EUR";Berlin
When I open this file manually by Excel from Windows Explorator, everything looks fine, all values are separated correctly. It looks like that:
When I try to open this by VBA, using
Workbooks.Open fileName:=strPath & "thisFile.csv"
data is separated by commas, so it looks like that:
The same wrong result pops out when I am using OpenText function
Workbooks.OpenText filename:=strPath & "thisFile.csv", DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=True, Comma:=False, Space:=False, Other:=False
and when I try use solution from this thread. Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…