Excel XP: problem opening csv file with macro

S

sparklingsilvy

Hello

I am converting Excel spreadsheets to the XP version.
In my excel I have a macro (very simple) to open a csv file and then
apply some filters to it.
When I run it in Excel XP, the csv file doesn't open correctly. It is
as if the field separator is not recognised and all fields are as a
unique text in the first column.
But, if I open the same csv file in Excel XP using File-->Open,
everything works fine.

Also, is there a forum with XP conversion problems? I would be
interested also in Access issues.

Thank you
 
D

Dave Peterson

VBA is pretty USA centric.

If your list separator isn't a comma, then your macro could have trouble.

You could either change your list separator.
in win98,
Windows Start button|Settings|control panel|Regional Settings Applet
Number tab (near the bottom)

Another way would be to rename your .csv file to .txt and then import it with
the settings you like.
 
S

sparklingsilvy

Hello,

It's me, again.
I did try already what you suggested and it doesn't work.
The way the macro imports (open) the file in XP seems to be indipendent
from the regional settings.
My list separator is a semicolon in the regional settings as well as in
the file I need to open. When I open the file (with double click on the
file or directly file-->open in xls), XP excel works fine and it
recognises the field separator as it should.
But if you do the same via a macro or VB, it just ignores it. It works
only if the separator is a comma, as if this field separator is somehow
embedded in the Excel XP code itself.
I am not an expert but it sounds like a small bug to me.
It was perfectly working in previous excel versions. I am losing a lot
of flexibility in reading files if they have to be only comma
separated.
(You have to consider that I receive these files from various different
sources).

Thanks again
Silvana
 
S

sparklingsilvy

oops

Forgot to say: renaming the file .txt works.
I guess I will have to contact all my sources and ask them to eithe
change the separator or the file extension.

Unless some of you can help!
:eek
 
D

Dave Peterson

Yep. VBA is USA centric. Either you use the comma or you find a workaround.

I was trying to say to use the comma as your list separator--and make sure those
..csv files have commas.

But I failed to say it in my post.

Glad you found a work-around.
 
Top