Changing Regional Settings from VBA

M

Michael Rekas

Hi there

Is it possible to change the date format to "dd-mm-yyyy" in the
Control Panel/ Regional Settings?

Thanks

Michael
 
C

Chip Pearson

Michael,

I would *strongly* recommend that you do NOT do this. These
setting affect all Windows applications, possibly with bad side
effects. Your application should NEVER change any setting outside
of Excel.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
M

Michael Rekas

Hi Chip

The situation is that there are ±60 workstations countrywide.

Some are configured yyyy/mm/dd, some mm/dd/yyyy and & most dd-mm-yyyy.

The reports thus have different date formats depending on which branch
is producing it.

A further problem is that there is a routine which extracts data from
an SQL database where the date is in text format. The routine works
fine on the dd-mm-yyyy workstations but is unpredictable on the
others. Today 16 May 2004 appears as 04-05-2016 rather than
16-05-2004.

We need for everyone in the organisation to set their Short Date to
this format. I thought that it would just be easier to use Excel to do
this rather than to rely on users (in our case many not that computer
literate) to click Start, Settings Control Panel or Start Control
Panel depending on their version.

Accordingly any other ideas would be appreciated.

Thanks

Michael
 
O

onedaywhen

Michael Rekas wrote ...
The situation is that there are ±60 workstations countrywide.
A further problem is that there is a routine which extracts data from
an SQL database where the date is in text format.
We need for everyone in the organisation to set their Short Date to
this format.

If you have a business need to change the all machines' regional
settings, regardless of your Excel project, then do it as a separate
project.

As regards your Excel project, in your SQL query you should use the
CAST function to convert from text to a date on the server i.e. before
it arrives into your workbook.

--
 
Top