VBA for Excel 2010/2013 - How to determine the system language

I am writing a macro that will contain both Hebrew and English, but I would like to show only Hebrew characters if the language standard of the system is set to Hebrew, otherwise I want to transliterate it in English.

This is due to the quirk of how Excel macros seem to deal with languages ​​or at least Hebrew (for some reason, even if you have a keyboard installed in Hebrew and will display Hebrew in almost every application, it will not be for Excel until you install the local system in Hebrew, and therefore, Hebrew will also not be displayed in the spreadsheet, although if you typed it directly in the cell, it will look normal - this is true for Excel 2010 and 2013 least).

In any case, I tried several lines that did not work, and they:

Application.LanguageSettings.LanguageID(msoLanguageIDUI) Application.LanguageSettings.LanguageID(msoLanguageIDInstall) Application.LanguageSettings.LanguagePreferredForEditing(msoLanguageIDHebrew) 

They did not work on defining the language system of the system and gave the same meaning, whether in English (USA) or Hebrew (Israel).

Can someone tell me what I need to do to indicate with a number or text what the system locale is?

+4
source share
2 answers

I found it here:

Your first line of code is Application.LanguageSettings.LanguageID(msoLanguageIDUI) giving an LCID that will be 1033 for English (US) or 1037 for Hebrew.

You can make a simple IF using Application.LanguageSettings.LanguageID(msoLanguageIDUI) to change the language using these numbers.

+1
source
 Sub LangCheck() Dim lang_code As Long lang_code = Application.LanguageSettings.LanguageID(msoLanguageIDUI) MsgBox lang_code End Sub 

US - 1033, Hebrew - 1037, according to this link:

MSDN

0
source

All Articles