Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I would like to modify the "Regional and Language Options"/"Standards and Formats" from "french canadian" to "english canadian" using vba. I tried to modify "LOCALE_IDEFAULTLANGUAGE" value but it doesn't work. I have pasted my program. Does anyone know how to make it work. Thank you! Alex Sub ModifyLanguage() Dim Symbol As String Dim iRet As Long Dim Locale As Long ' Locale = GetSystemDefaultLCID() Locale = GetUserDefaultLCID() 'Get user Locale ID Symbol = "1009" MsgBox GetInfo(LOCALE_IDEFAULTLANGUAGE) 'Give "0c0c" Call SetLocaleInfo(Locale, LOCALE_IDEFAULTLANGUAGE, Symbol) MsgBox GetInfo(LOCALE_IDEFAULTLANGUAGE) 'Still give "0c0c" ??? End Sub Public Const LOCALE_USER_DEFAULT = &H400 Public Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country Public Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language Public Const LOCALE_SNATIVELANGNAME = &H4 ' native name of language Public Const LOCALE_SNATIVECTRYNAME = &H8 ' native name of country Public Const LOCALE_IDEFAULTCODEPAGE = &HB Public Const LOCALE_IDEFAULTCOUNTRY = &HA Public Const LOCALE_IDEFAULTLANGUAGE = &H9 Public Const LOCALE_ILANGUAGE = &H1 Public Const LOCALE_SLANGUAGE = &H2 Declare Function GetLocaleInfo Lib "kernel32" Alias _ "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _ ByVal lpLCData As String, ByVal cchData As Long) As Long Declare Function SetLocaleInfo Lib "kernel32" Alias _ "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _ ByVal lpLCData As String) As Boolean Declare Function GetUserDefaultLCID% Lib "kernel32" () Public Function GetInfo(ByVal lInfo As Long) As String Dim buffer As String, Ret As String buffer = String$(256, 0) Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, buffer, Len(buffer)) If Ret 0 Then GetInfo = Left$(buffer, Ret - 1) Else GetInfo = "" End If End Function -- Alex St-Pierre |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linking dats on a worksheet to control panel | Charts and Charting in Excel | |||
Excel 2007 using control panel display settings | Excel Discussion (Misc queries) | |||
Control panel detection | Excel Programming | |||
Control Panel-Dual Display API | Excel Programming | |||
Control Panel | Excel Programming |