Workbooks.Open and Localisation

Alderm

New Member
Joined
Jun 14, 2018
Messages
1
I have created an Excel dashboard that uses VBA code to import data files in csv format. The data includes dates, and since I and other users are European I had to add the "Local:=True" parameter to my Workbooks.Open command to avoid certain European format dates being converted into US date formats.

This worked well for me. I am based in the UK so my Windows local settings are DD/MM/YY date format and the delimiter is comma. However when I tried to enable the same dashboard with import code for a colleague in Austria I hit a problem with the delimiter. In Austria the Windows delimiter is a semi-colon, which meant the CSV files were not delimited when opened by them.

Luckily Workbooks.Open has another parameter - Format - which allows me to default to using a comma for files opened with this command. Therefore adding Format:=2 as a parameter for Workbooks.Open meant the data import then also worked for my Austrian colleague.

However... here is the problem: the Format:=2 only worked when I removed the Local:=True parameter. If I include Local:=True, in whatever sequence, with Format:=2 the Format parameter is then ignored and the csv file is loaded assuming a semi-colon delimiter. If I delete the Local:=True parameter then the import switches to commas but the date format problem reappears!

It seems that Local cancels out or takes priority over Format. Is there anything I can do to enable both? Or is there a different way to achieve both?

Thanks for any advice!

Peter
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Have you tried using OpenText instead, which will allow you to specify separators, as well as date formats using the FieldInfo argument?
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top