CSV separator in macro?

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?
 
Joined
Jun 21, 2005
Messages
21
Reaction score
0
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?
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top