LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Modify language options from control panel using VBA

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking dats on a worksheet to control panel sbearman Charts and Charting in Excel 0 June 25th 08 01:35 PM
Excel 2007 using control panel display settings Mark Excel Discussion (Misc queries) 0 June 12th 07 08:36 PM
Control panel detection Jags Excel Programming 2 February 14th 06 12:36 PM
Control Panel-Dual Display API Vacation's Over Excel Programming 2 September 18th 05 07:37 PM
Control Panel Matt Excel Programming 1 March 22nd 05 07:01 PM


All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"