Language Code, French, Spanish, or Spanish

drom

Well-known Member
Joined
Mar 20, 2005
Messages
528
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advance

If I do this in a Computer's inmediate window "VBA":

Code:
?Application.LanguageSettings.LanguageID(msoLanguageIDUI)
I will get eg:
  • 3082 'The Spanish Modern Sort language.
  • 1045 'The Polish language.
  • 4108 'The Swiss French language.
and/or...

But I don't really care if the French is from Senegal, France, Swiss etc
I don't care if the English is from Ireland, England, USA...

How can I know if the Language is Spanish, French or English

PS: ovbiously a solution rather that one that makes me insert all the differents country codes

or How can I know Application.LanguageSettings.LanguageID(msoLanguageIDUI).description ??
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hello drom,

This UDF will return the language name for a LCID. Copy and Paste this code into a standard VBA module.
Code:
' Written: March 01, 2012
' Author:  Leith Ross
' Summary: Converts a Language Code Identifier (LCID) into the language name.

Private Declare Function GetLocaleInfoA _
    Lib "kernel32.dll" _
        (ByVal Locale As Long, _
         ByVal LCType As Long, _
         ByVal lpLCData As String, _
         ByVal cch As Long) _
    As Long
    
Function GetLanguageName(ByVal LCID As Long) As String

    Const LOCALE_SENGLANGUAGE As Long = &H1001
    Const LOCALE_SENGCOUNTRY As Long = &H1002
    
    Dim Buffer As String
    Dim BuffSize As Long
    Dim RetVal As Long
    
        BuffSize = GetLocaleInfoA(LCID, LOCALE_SENGLANGUAGE, 0, 0)
        Buffer = String(BuffSize, Chr(0))
        
        RetVal = GetLocaleInfoA(LCID, LOCALE_SENGLANGUAGE, Buffer, BuffSize)
        
        If RetVal > 0 Then GetLanguageName = Left(Buffer, BuffSize - 1)
        
End Function
Example of Calling the Function
This is for Spanish.
Code:
  ' Using the Decimal value
    Language = GetLanguageName(1034)

  ' Using the Hex value
    Language = GetLanguageName(&H40A)
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,276
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top