Which language is active?

Posted on 2006-05-16
Last Modified: 2007-12-19
Hello experts,

I need a macro to show which language is active in the documents' spelling checker, and if the hyphenation of that language is active??

Thanks a lot,

Question by:LuckyLuke57
    LVL 44

    Accepted Solution

    Hello LuckyLuke57,

    there is some info in the word vba help about language detection in word from which this sample came
    With ActiveDocument
        If .Range.LanguageID = wdEnglishUS Then
            MsgBox "This is a U.S. English document."
            MsgBox "This is not a U.S. English document."
        End If
    End With

    of for the current selection you're typing

    If Selection.LanguageID = wdEnglishUS Then
      MsgBox "Spell check is currently set to U.S. English"
      MsgBox "Spell check is currently set to another language then U.S. English"
    End If

    the wdLanguageId's are found in the object browser [F2] in the vb editor

    If ActiveDocument.Styles("Normal").ParagraphFormat.Hyphenation then
      MsgBox "Hyphenation is active for paragrpahs with a style of normal"
    End If

    hope this helps a bit
    LVL 76

    Assisted Solution

    You might also like to use this function to return the language in text form:

    Function GetLanguageDescription(LangID As Long) As String
        Dim strLanguage As String
        Select Case LangID
            Case wdAfrikaans
                strLanguage = "Afrikaans "
            Case wdAlbanian
                strLanguage = "Albanian"
            Case wdArabic
                strLanguage = "Arabic"
            Case wdArabicAlgeria
                strLanguage = "Arabic Algeria"
            Case wdArabicBahrain
                strLanguage = "Arabic Bahrain"
            Case wdArabicEgypt
                strLanguage = "Arabic Egypt"
            Case wdArabicIraq
                strLanguage = "Arabic Iraq"
            Case wdArabicJordan
                strLanguage = "Arabic Jordan"
            Case wdArabicKuwait
                strLanguage = "Arabic Kuwait"
            Case wdArabicLebanon
                strLanguage = "Arabic Lebanon"
            Case wdArabicLibya
                strLanguage = "Arabic Libya"
            Case wdArabicMorocco
                strLanguage = "Arabic Morocco"
            Case wdArabicOman
                strLanguage = "Arabic Oman"
            Case wdArabicQatar
                strLanguage = "Arabic Qatar"
            Case wdArabicSyria
                strLanguage = "Arabic Syria"
            Case wdArabicTunisia
                strLanguage = "Arabic Tunisia"
            Case wdArabicUAE
                strLanguage = "Arabic UAE"
            Case wdArabicYemen
                strLanguage = "Arabic Yemen"
            Case wdArmenian
                strLanguage = "Armenian"
            Case wdAssamese
                strLanguage = "Assamese"
            Case wdAzeriCyrillic
                strLanguage = "Azeri Cyrillic"
            Case wdAzeriLatin
                strLanguage = "Azeri Latin"
            Case wdBasque
                strLanguage = "Basque"
            Case wdBelgianDutch
                strLanguage = "Belgian Dutch"
            Case wdBelgianFrench
                strLanguage = "Belgian French"
            Case wdBengali
                strLanguage = "Bengali"
            'Case wdBosniaHerzegovina
                'strLanguage = "Bosnia-Herzegovina"
            Case wdBrazilianPortuguese
                strLanguage = "Brazilian Portuguese"
            Case wdBulgarian
                strLanguage = "Bulgarian"
            Case wdBurmese
                strLanguage = "Burmese"
            Case wdByelorussian
                strLanguage = "Byelorussian"
            Case wdCatalan
                strLanguage = "Catalan"
            Case wdChineseHongKong
                strLanguage = "Chinese Hong Kong"
            Case wdChineseMacao
                strLanguage = "Chinese Macao"
            Case wdChineseSingapore
                strLanguage = "Chinese Singapore"
            Case wdCroatian
                strLanguage = "Croatian"
            Case wdCzech
                strLanguage = "Czech"
            Case wdDanish
                strLanguage = "Danish"
            Case wdDutch
                strLanguage = "Dutch"
            Case wdEnglishAUS
                strLanguage = "English AUS"
            Case wdEnglishBelize
                strLanguage = "English Belize"
            Case wdEnglishCanadian
                strLanguage = "English Canadian"
            Case wdEnglishCaribbean
                strLanguage = "English Caribbean"
            Case wdEnglishIreland
                strLanguage = "English Ireland"
            Case wdEnglishJamaica
                strLanguage = "English Jamaica"
            Case wdEnglishNewZealand
                strLanguage = "English NewZealand"
            Case wdEnglishPhilippines
                strLanguage = "English Philippines"
            Case wdEnglishSouthAfrica
                strLanguage = "English SouthAfrica"
            Case wdEnglishTrinidad
                strLanguage = "English Trinidad"
            Case wdEnglishUK
                strLanguage = "English UK"
            Case wdEnglishUS
                strLanguage = "English US"
            Case wdEnglishZimbabwe
                strLanguage = "English Zimbabwe"
            Case wdEstonian
                strLanguage = "Estonian"
            Case wdFaeroese
                strLanguage = "Faeroese"
            Case wdFarsi
                strLanguage = "Farsi"
            Case wdFinnish
                strLanguage = "Finnish"
            Case wdFrench
                strLanguage = "French"
            Case wdFrenchCameroon
                strLanguage = "French Cameroon"
            Case wdFrenchCanadian
                strLanguage = "French Canadian"
            Case wdFrenchCotedIvoire
                strLanguage = "French Cote d'Ivoire"
            Case wdFrenchLuxembourg
                strLanguage = "French Luxembourg"
            Case wdFrenchMali
                strLanguage = "French Mali"
            Case wdFrenchMonaco
                strLanguage = "French Monaco"
            Case wdFrenchReunion
                strLanguage = "French Reunion"
            Case wdFrenchSenegal
                strLanguage = "French Senegal"
            Case wdFrenchWestIndies
                strLanguage = "French West Indies"
            Case wdFrenchZaire
                strLanguage = "French Zaire"
            Case wdFrisianNetherlands
                strLanguage = "Frisian Netherlands"
            Case wdGaelicIreland
                strLanguage = "Gaelic Ireland"
            Case wdGaelicScotland
                strLanguage = "Gaelic Scotland"
            Case wdGalician
                strLanguage = "Galician"
            Case wdGeorgian
                strLanguage = "Georgian"
            Case wdGerman
                strLanguage = "German"
            Case wdGermanAustria
                strLanguage = "German Austria"
            Case wdGermanLiechtenstein
                strLanguage = "German iechtenstein"
            Case wdGermanLuxembourg
                strLanguage = "German Luxembourg"
            Case wdGreek
                strLanguage = "Greek"
            Case wdGujarati
                strLanguage = "Gujarati"
            Case wdHebrew
                strLanguage = "Hebrew"
            Case wdHindi
                strLanguage = "Hindi"
            Case wdHungarian
                strLanguage = "Hungarian"
            Case wdIcelandic
                strLanguage = "Icelandic"
            Case wdIndonesian
                strLanguage = "Indonesian"
            Case wdItalian
                strLanguage = "Italian"
            Case wdJapanese
                strLanguage = "Japanese"
            Case wdKannada
                strLanguage = "Kannada"
            Case wdKashmiri
                strLanguage = "Kashmiri"
            Case wdKazakh
                strLanguage = "Kazakh"
            Case wdKhmer
                strLanguage = "Khmer "
            Case wdKirghiz
                strLanguage = "Kirghiz"
            Case wdKonkani
                strLanguage = "Konkani"
            Case wdKorean
                strLanguage = "Korean"
            Case wdLanguageNone
                strLanguage = "Language None"
            Case wdLao
                strLanguage = "Lao"
            Case wdLatvian
                strLanguage = "Latvian"
            Case wdLithuanian
                strLanguage = "Lithuanian"
            'Case wdLithuanianClassic
                'strLanguage = "Lithuanian Classic"
            Case wdMacedonian
                strLanguage = "Macedonian"
            Case wdMalayalam
                strLanguage = "Malayalam"
            Case wdMalayBruneiDarussalam
                strLanguage = "Malay Brunei Darussalam"
            Case wdMalaysian
                strLanguage = "Malaysian"
            Case wdMaltese
                strLanguage = "Maltese"
            Case wdManipuri
                strLanguage = "Manipuri"
            Case wdMarathi
                strLanguage = "Marathi"
            Case wdMexicanSpanish
                strLanguage = "Mexican Spanish"
            Case wdMongolian
                strLanguage = "Mongolian"
            Case wdNepali
                strLanguage = "Nepali"
            Case wdNoProofing
                strLanguage = "No Proofing"
            Case wdNorwegianBokmol
                strLanguage = "Norwegian Bokmol"
            Case wdNorwegianNynorsk
                strLanguage = "Norwegian Nynorsk"
            Case wdOriya
                strLanguage = "Oriya"
            Case wdPolish
                strLanguage = "Polish"
            Case wdPortuguese
                strLanguage = "Portuguese"
            Case wdPunjabi
                strLanguage = "Punjabi"
            Case wdRhaetoRomanic
                strLanguage = "Rhaeto Romanic"
            Case wdRomanian
                strLanguage = "Romanian"
            Case wdRomanianMoldova
                strLanguage = "Romanian Moldova"
            Case wdRussian
                strLanguage = "Russian"
            Case wdRussianMoldova
                strLanguage = "Russian Moldova"
            Case wdSamiLappish
                strLanguage = "Sami Lappish"
            Case wdSanskrit
                strLanguage = "Sanskrit"
            Case wdSerbianCyrillic
                strLanguage = "Serbian Crillic"
            Case wdSerbianLatin
                strLanguage = "Serbian Latin"
            Case wdSesotho
                strLanguage = "Sesotho"
            Case wdSimplifiedChinese
                strLanguage = "Simplified Chinese"
            Case wdSindhi
                strLanguage = "Sindhi"
            Case wdSlovak
                strLanguage = "Slovak"
            Case wdSlovenian
                strLanguage = "Slovenian"
            Case wdSorbian
                strLanguage = "Sorbian"
            Case wdSpanish
                strLanguage = "Spanish"
            Case wdSpanishArgentina
                strLanguage = "Spanish Argentina"
            Case wdSpanishBolivia
                strLanguage = "Spanish Bolivia"
            Case wdSpanishChile
                strLanguage = "Spanish Chile"
            Case wdSpanishColombia
                strLanguage = "Spanish Colombia"
            Case wdSpanishCostaRica
                strLanguage = "Spanish Costa Rica"
            Case wdSpanishDominicanRepublic
                strLanguage = "Spanis Dominican Republic"
            Case wdSpanishEcuador
                strLanguage = "Spanish Ecuador"
            Case wdSpanishElSalvador
                strLanguage = "Spanish El Salvador"
            Case wdSpanishGuatemala
                strLanguage = "Spanish Guatemala"
            Case wdSpanishHonduras
                strLanguage = "Spanish Honduras"
            Case wdSpanishModernSort
                strLanguage = "Spanish Modern Sort"
            Case wdSpanishNicaragua
                strLanguage = "Spanish Nicaragua"
            Case wdSpanishPanama
                strLanguage = "Spanish Panama"
            Case wdSpanishParaguay
                strLanguage = "Spanish Paraguay"
            Case wdSpanishPeru
                strLanguage = "Spanish Peru"
            Case wdSpanishPuertoRico
                strLanguage = "Spanish Puerto Rico"
            Case wdSpanishUruguay
                strLanguage = "Spanish Uruguay"
            Case wdSpanishVenezuela
                strLanguage = "Spanish Venezuela"
            Case wdSutu
                strLanguage = "Sutu"
            Case wdSwahili
                strLanguage = "Swahili"
            Case wdSwedish
                strLanguage = "Swedish"
            Case wdSwedishFinland
                strLanguage = "Swedish Finland"
            Case wdSwissFrench
                strLanguage = "Swiss French"
            Case wdSwissGerman
                strLanguage = "Swiss German"
            Case wdSwissItalian
                strLanguage = "Swiss Italian"
            Case wdTajik
                strLanguage = "Tajik"
            Case wdTamil
                strLanguage = "Tamil"
            Case wdTatar
                strLanguage = "Tatar"
            Case wdTelugu
                strLanguage = "Telugu"
            Case wdThai
                strLanguage = "Thai"
            Case wdTibetan
                strLanguage = "Tibetan"
            Case wdTraditionalChinese
                strLanguage = "Traditional Chinese"
            Case wdTsonga
                strLanguage = "Tsonga"
            Case wdTswana
                strLanguage = "Tswana"
            Case wdTurkish
                strLanguage = "Turkish"
            Case wdTurkmen
                strLanguage = "Turkmen"
            Case wdUkrainian
                strLanguage = "Ukrainian"
            Case wdUrdu
                strLanguage = "Urdu"
            Case wdUzbekCyrillic
                strLanguage = "Uzbek Cyrillic"
            Case wdUzbekLatin
                strLanguage = "Uzbek Latin"
            Case wdVenda
                strLanguage = "Venda"
            Case wdVietnamese
                strLanguage = "Vietnamese"
            Case wdWelsh
                strLanguage = "Welsh"
            Case wdXhosa
                strLanguage = "Xhosa"
            Case wdZulu
                strLanguage = "Zulu"
            Case 9999999
                strLanguage = "Mixed Languages"
        End Select
        GetLanguageDescription = strLanguage
    End Function
    LVL 10

    Author Comment


    Hello Bruintje & Graham,

    I come back to that tomorrow.
    Seems to be good, don't have time to test & grant points.

    Lucky Luke
    LVL 10

    Author Comment

    Sorry, I missed this one!!!

    I forgot to come back to this question, and then I went in vacation for almost a month.
    Give me the chance to investigate the answers next tuesday, and then I will decide how to give points.

    So administrator: don't take any action for the moment...


    LVL 10

    Author Comment

    Both answers were very valuable.

    CU folks, sorry for the waiting.


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
    Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
    This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
    This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now