CSV separator in macro?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've changed the list separator to semicolon. Now I try to open csv file
(delimited by semicolons) from macro with command: Workbooks.Open
FileName:="filename.csv", but it doesn't work. The entire row open to first
cell. how can I tell in open command the separator is semicolon?
 
You need to specify more:

Workbooks.OpenText Filename:= _
"<Path & filename>", _
StartRow:=2, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=False, _
Semicolon:=True, _
Comma:=False, _
Space:=False, _
Other:=False



=?Utf-8?B?UGV0ZQ==?= said:
I've changed the list separator to semicolon. Now I try to open csv file
(delimited by semicolons) from macro with command: Workbooks.Open
FileName:="filename.csv", but it doesn't work. The entire row open to first
cell. how can I tell in open command the separator is semicolon?
 
Use the OpenText method instead. Also, you will probably need to rename the
file to have a .txt extension. sometimes Excel makes its own decisions when
opening .CSV files.

or you can use Chip Pearson's code (or write your own)
http://www.cpearson.com/excel/imptext.htm import/export text files
 
Back
Top