ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to know the windows language (https://www.excelbanter.com/excel-programming/381602-how-know-windows-language.html)

Alex St-Pierre

How to know the windows language
 
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

Don Guillett

How to know the windows language
 
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




Alex St-Pierre

How to know the windows language
 
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





Steve Yandl

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







Peter T

How to know the windows language
 
Not sure if it will help you but have a look at LanguageSettings in help,
also the intellisence

Dim LS As LanguageSettings
Set LS = Application.LanguageSettings

nInstall = LS.LanguageID(msoLanguageIDInstall)
nDUI = LS.LanguageID(msoLanguageIDUI)
bool = LS.LanguagePreferredForEditing(msoLanguageIDFrench Canadian)

also perhaps -

nCS = application.International(xlCountrySetting)
and various other relevant default formatting info that can be changed in
say the Normal style of a workbook if necessary.

Regards,
Peter T


"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





All times are GMT +1. The time now is 12:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com