Hi,
First of all, many thanks for all the posts on this great forum. I tried VBA for the first time six months ago and I've never looked back since. The forum has provided so many solutions/ideas without frequently having to post. I really have learnt so many new things
I do, however, have to rack your brains for one thing...does anyone know how to change the locale in Control Panel...Regional Settings directly from VBA? The majority of the systems at work are configured to United States instead of United Kingdom and this poses a problem for the date format in the tool I've written. I'd really like to have the macro change the settings automatically rather than ask the user to do so manually. Is there any way this is possible?
I've seen the following code in a post to change the decimal from . to , and back:
But, does anybody know the code to change the whole locale to UK? Or at least the code to change the date to dd/mm/yyyy for vbShortDate?
Many thanks and best regards,
Jules
First of all, many thanks for all the posts on this great forum. I tried VBA for the first time six months ago and I've never looked back since. The forum has provided so many solutions/ideas without frequently having to post. I really have learnt so many new things

I do, however, have to rack your brains for one thing...does anyone know how to change the locale in Control Panel...Regional Settings directly from VBA? The majority of the systems at work are configured to United States instead of United Kingdom and this poses a problem for the date format in the tool I've written. I'd really like to have the macro change the settings automatically rather than ask the user to do so manually. Is there any way this is possible?
I've seen the following code in a post to change the decimal from . to , and back:
Code:
Private Declare Function SetLocaleInfo _
Lib "kernel32" Alias "SetLocaleInfoA" ( _
ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String) As Boolean
Private Declare Function GetUserDefaultLCID% Lib "kernel32" ()
Private Const LOCALE_SDECIMAL = &HE
Private Sub ChangeSettingExample()
'change the setting of the character displayed as the decimal separator.
Call SetLocalSetting(LOCALE_SDECIMAL, ",") 'to change to ","
'check your control panel to verify or use the
'GetLocaleInfo API function
Stop
Call SetLocalSetting(LOCALE_SDECIMAL, ".") 'to back change to "."
End Sub
Private Function SetLocalSetting(LC_CONST As Long, Setting As String) As Boolean
Call SetLocaleInfo(GetUserDefaultLCID(), LC_CONST, Setting)
End Function
But, does anybody know the code to change the whole locale to UK? Or at least the code to change the date to dd/mm/yyyy for vbShortDate?
Many thanks and best regards,
Jules