View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Steve Yandl Steve Yandl is offline
external usenet poster
 
Posts: 284
Default How to know the windows language

Alex,

If you're running on systems with only a single OS installed and the OS is
WinXP, WinME, Win2k or beyond, then WMI is present and the following will
work. The OS language will be returned as a code value; 1033 for American
English, 1036 for French.

Sub OSlanguage()
Dim objWMI As Object
Dim colItems As Object
Dim objItem As Object
Dim languageCode As Integer

Set objWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cim v2")
Set colItems = objWMI.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objItem In colItems
languageCode = objItem.OSlanguage
Next objItem

MsgBox languageCode

End Sub


Steve Yandl



"Alex St-Pierre" wrote in message
...
I would like to know if the OS is french or english, is there a way to know
that?
Thanks!
--
Alex St-Pierre


"Don Guillett" wrote:

Sub os()
MsgBox Application.OperatingSystem

End Sub


--
Don Guillett
SalesAid Software

"Alex St-Pierre" wrote in
message
...
Hi,
I'm wondering if there's a way to know what is the windows language
installed inside the computer where the macro is runned. I tried to
find a
parameter inside GetLocaleInfo function but all seems to be related to
control panel settings. Any idea?
Thanks!
Alex
--
Alex St-Pierre