PDA

View Full Version : Windows language settings



peggyj2007
05-04-2008, 01:25 PM
Hi All,

I have a client who has users working in Canadian English and French. Their window settings are set according to language of choice. One of the things is commas between numbers in French. As an example an English margin setting is 1.5 inches where the French margin setting would be 1,5. When I run the English margin setting though the macro when set up on a French workstation I get an error due to this.

Now I can get this set up into variables with no problem as the English ones are set up this way but how do I find out what language Windows is set in from within VBA/the macro? An INI file is not an option as the client does not want this under any circumstance.

Thanks in advance
Peggy

Oorang
05-04-2008, 08:47 PM
I haven't personally used this but I think you can tell with:
Application.LanguageSettings.LanguageID(msoLanguageIDUI)

peggyj2007
05-05-2008, 03:14 AM
No doesn't work. Tried it with the English and French and other language changes in Windows and keep getting the same settings back. Thanks for your help though.

peggyj2007
05-05-2008, 04:14 AM
Found a fix and am posting it up to share for anyone who needs it

I was able to extract the Windows language by using System.LanguageDesignation and extracted it as a variable as below. Works great now!


Dim winlang As String
winlang = System.LanguageDesignation
'MsgBox winlang

It returns the language and I have assigned the specific variables using commas or periods according to that.

fumei
05-05-2008, 06:05 AM
I empathize with your situation as I work for the Canadian government and that english/french thing can be a real pain in the butt.