csv import from different locale?

Giganews Newsgroups
Subject: csv import from different locale?
Posted by:  Ethan Strauss
Date: Mon, 16 Mar 2009

Hi,
  I would like to be able to have computers with one region/locale setting
correctly import .csv files created with different locale settings.
Specifically, the files are created with US settings and are being read with
German settings, but it would be best if there was a general solution for all
settings.
  My first thought was to write a macro with does the following

Save user's current settings in a variable
Change settings to US
Import file (open dialog etc)
Change setting back to original.
But, I can't find a way to alter the locale using VBA within Excel.
I have a semi working macro with imports the file using
Application.ActiveSheet.QueryTables.Add(Connection:=fileName,
Destination:=Range("$A$1")) and making sure that all rows are interpreted as
text, then replacing all periods with commas, then formatting everything as
numbers, but this has issues.
So,  is it possible to change locale settings from within Excel VBA?
If not, any ideas how to deal with csv import locale issues?

Thanks!
Ethan

Replies