| First Published 18 Sept 2026 | Last Updated 23 Sept 2026 |
|---|
As stated in my recent article, Get Office License Info Using Code, the six new SysCmd actions released with version 2604 provide very useful information about the installed Office version.
For example SysCmd(acSysCmdGetFullVersion) or SysCmd(720) give the full version info:
The other five new SysCmd values, 721 through to 725, provide the individual components of that information.
These new commands are available in all Click to Run Consumer editions (NOT LTSC) of Access from 2016 onwards as well as in Access 365.
The new commands make it much easier to obtain the full Access version, build and bitness information from clients when they report issues.
It also helps with troubleshooting when forum members report possible Access bugs.
Unfortunately, none of the SysCmd actions include information about the Office language installed for the current user.
This is an important omission, as some Office bugs/issues can be language specific. This article shows how the information can be obtained using VBA code.
Setting the Office language
The Office language is specified during installation and can be edited from the Options menu. For example, in Access Options:
The preferred language specified here will apply to all Office apps but requires Office to be restarted.
NOTE: Before you can use a language in Office, the related language pack must be installed from Windows Settings|Language:
Language properties are read-only and cannot be set in code.
The language properties are saved in the registry at: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\LanguageResources.
These registry values can be edited directly. However, the values of many properties can be easily obtained using built-in VBA functions.
Getting Office language info using VBA
Using the language settings code requires the reference library Microsoft Office 16.0 Object Library to be added to your VBA project.
The Application.LanguageSettings property has five members:
We will be using the LanguageID property (msoAppLanguageID)
The msoAppLanguageID property is a constant used to return locale identifier (LCID) information to the specified application. See MsoLanguageID enumeration (Office)
Each of these items will return a constant value representing one of the 216 available Office languages e.g. msoLanguageIDEnglishUK = 2057, msoLanguageIDGerman = 1031.
Many Office users never change their Office language and so the values returned for each item will be the same as the install language.
However, some developers, including myself, regularly change Office languages for testing applications prior to deployment.
For example, my install language was English UK (2057) but this was recently changed - first to Spanish Modern (3082) and again to German (1031).
As a result, when using code, the following constant values were returned:
To make the code more user friendly, it would be possible to set these enumeration values in a module. However, this would be very unwieldy with 216 members.
Until now, my preferred solution has been to store this information in a table, tblMsoLang. This is included in the example database below.
Using this table, we can now get descriptive output using a helper function GetLocale
'---------------------------------------------------------------------------------------' Module : modLocale' DateTime : 04/10/2021' Author : Colin Riddington (Mendip Data Systems)' Website : https://www.isladogs.co.uk' Purpose : Code used to manage locale data' Copyright : The code in the utility MAY be altered and reused in your own applications' provided the copyright notice is left unchanged (including Author, Website and Copyright)' You are NOT allowed to sell, resell or repost this on other sites such as online forums' without permission from the author. However, links back to the above websites ARE allowed.' If you find this code useful please place a link to my website on your own web site' so that others may benefit as well.' Updated : October 2021'---------------------------------------------------------------------------------------'Useful links'https://learn.microsoft.com/en-us/office/vba/api/office.msolanguageid'https://stackoverflow.com/questions/8588728/find-the-current-user-language'API to get the Windows language for the current userPrivate Declare PtrSafe Function GetUserDefaultUILanguage Lib "kernel32.dll" () As LongPublic strLocale As String, strLangCode As String, strOfficeLang As String, strOfficeLangCode As StringFunction GetLocale(ByVal lngCode) As StringOn Error GoTo Err_Handler GetLocale = Nz(DLookup("Language", "tblMsoLang", "MsoLangValue = " & lngCode), "") Exit_Handler: Exit FunctionErr_Handler: MsgBox "Error " & Err.Number & " in GetLocale procedure:" & vbCrLf & _ Err.Description, vbCritical, "GetLocale error" Resume Exit_HandlerEnd Function
The following functions are used with GetLocale and LanguageSettings.LanguageID to obtain various Office language related items:
'######### Office Language functions #########Public FunctionGetCurrentOfficeLanguageEnum()'get current Office language enum e.g. 2057 (for English UK)GetCurrentOfficeLanguageEnum=Application.LanguageSettings.LanguageID(msoLanguageIDUI)End FunctionPublic FunctionGetCurrentOfficeLanguage()'get current Office language e.g. English UKGetCurrentOfficeLanguage=GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDUI))End FunctionPublic FunctionGetCurrentOfficeLangCode()'get current Office lang code e.g. enGetCurrentOfficeLangCode=Nz(DLookup("LangCode", "tblMsoLang", "Language ='"&GetCurrentOfficeLanguage& "'"), "")End FunctionPublic FunctionGetCurrentLanguage()'get language in tblLanguages corresponding to current Office lang code e.g. EnglishGetCurrentLanguage=Nz(DLookup("Language", "tblLanguages", "Code ='"&GetCurrentOfficeLangCode& "'"), "")End FunctionPublic FunctionGetOfficeHelpLanguage()'get Office help language e.g. English USGetOfficeHelpLanguage=GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDHelp))End FunctionPublic FunctionGetOfficeInstallLanguageEnum()'get Office install language enum e.g. 1033 (for English US)GetOfficeInstallLanguageEnum=Application.LanguageSettings.LanguageID(msoLanguageIDInstall)End FunctionPublic FunctionGetOfficeInstallLanguage()'get Office install language e.g. English USGetOfficeInstallLanguage=GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDInstall))End FunctionPublic FunctionGetPreviousOfficeLanguageEnum()'get previous Office language enum e.g. 1031 (for German)GetPreviousOfficeLanguageEnum=Application.LanguageSettings.LanguageID(msoLanguageIDUIPrevious)End FunctionPublic FunctionGetPreviousOfficeLanguage()'get previous Office language e.g. GermanGetPreviousOfficeLanguage=GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDUIPrevious))End Function
The code in the next two procedures are examples which give message box output:
SubGetLocaleInfo()DimlngCodeAs Long'This gives current Office language as code and in wordslngCode=Application.LanguageSettings.LanguageID(msoLanguageIDUI)MsgBox"Locale Code: "&lngCode&vbCrLf& "Locale: "&GetLocale(lngCode), , "Current Office language"End SubSubOfficeInstallLanguage()DimlngCodeAs Long'This gives Office installation language e.g. English UK (but may not be current language)lngCode=Application.LanguageSettings.LanguageID(msoLanguageIDInstall)MsgBox"The language used for MS Office installation was: "&vbCrLf& _"Code: "&lngCode&vbCrLf& "Locale: "&GetLocale(lngCode), , "Office Installation language"End Sub
VBE Language Code
The language/locale used in the Visual Basic Editor (VBE) is often identical to the current Office language. However, the list of languages available is more limited.
For example, where the Office language is English (United Kingdom), the VBE Language is English (United States).
In addition, differences can occur after swapping Office languages and then reverting to the default language. For example:
For more details, see my article:
BUG: Office & VBE Menu Languages Different
For both those reasons, I have provided separate code to determine the VBE language.
There is no built-in code to determine the VBE language. The approach used here was supplied by Xevi Batlle based on suggestions made by Google Gemini AI.
The code is in module modVBELang and returns the VBE Language enum (LCID) by identifying the folder name for the file VBE7INTL.DLL.
The file path structure is: . . .\Microsoft Shared\VBA\VBA7.1\<LCID>\VBE7INTL.DLL.
Private Declare PtrSafe FunctionGetModuleHandleLib"kernel32"Alias"GetModuleHandleA"_(ByVallpModuleNameAs String)As LongPtrPrivate Declare PtrSafe FunctionGetModuleFileNameLib"kernel32"Alias"GetModuleFileNameA"_(ByValhModuleAs LongPtr,ByVallpFilenameAs String,ByValnSizeAs Long)As Long'https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfowPrivate Declare PtrSafe FunctionGetLocaleInfoWLib"kernel32"( _ByValLocaleAs Long, _ByValLCTypeAs Long, _ByVallpLCDataAs LongPtr, _ByValcchDataAs Long)As LongPrivate ConstLOCALE_SLOCALIZEDCOUNTRYNAMEAs Long= &H6'e.g. SpainPrivate ConstLOCALE_SLOCALIZEDDISPLAYNAMEAs Long= &H72'Spanish (Spain, International Sort)Private ConstLOCALE_SLOCALIZEDLANGUAGENAMEAs Long= &H6F'e.g. Spanish' Returns the VBE Language Enum by identifying the folder name for VBE7INTL.DLLPublic FunctionGetVBELanguageEnum()As StringDimhModuleAs LongPtrDimbufferAs String* 260DimlengthAs LongDimdllPathAs StringDimparts()As String' Get handle of the VBE international resources DLL loaded in memoryhModule=GetModuleHandle("VBE7INTL.DLL")IfhModule<> 0Thenlength=GetModuleFileName(hModule,buffer, 260)dllPath=Left(buffer,length)' Debug.Print dllPath' Path structure: ...\Microsoft Shared\VBA\VBA7.1\<LCID>\VBE7INTL.DLLparts=Split(dllPath, "\")' Return the folder name immediately preceding the DLLIf UBound(parts) >= 1ThenGetVBELanguageEnum=parts(UBound(parts) - 1)Exit FunctionEnd IfEnd IfGetVBELanguageEnum= "Unknown"End Function
Three further functions are used with the LCID value from GetVBELanguageEnum to obtain various VBE language related items:
'Returns the language namePublic FunctionGetLanguageName(lcidAs Long)As StringDimnAs LongDimsAs StringOn Error GoToErrorHandlerIflcid= 0Then Exit Functionn=GetLocaleInfoW(lcid,LOCALE_SLOCALIZEDLANGUAGENAME, 0, 0)Ifn> 0Thens=String$(n,vbNullChar)GetLocaleInfoW lcid,LOCALE_SLOCALIZEDLANGUAGENAME,StrPtr(s),nGetLanguageName=Left$(s,n- 1)End IfExit FunctionErrorHandler:GetLanguageName=vbNullStringEnd Function'Returns the locale namePublic FunctionGetCountryName(lcidAs Long)As StringDimnAs LongDimsAs StringOn Error GoToErr_HandlerIflcid= 0Then Exit Functionn=GetLocaleInfoW(lcid,LOCALE_SLOCALIZEDCOUNTRYNAME, 0, 0)Ifn> 0Thens=String$(n,vbNullChar)GetLocaleInfoW lcid,LOCALE_SLOCALIZEDCOUNTRYNAME,StrPtr(s),nGetCountryName=Left$(s,n- 1)End IfExit_Handler:Exit FunctionErr_Handler:GetCountryName=vbNullStringResumeExit_HandlerEnd Function'Returns the language and locale namesPublic FunctionGetFullLanguageDisplayName(lcidAs Long)As StringDimnAs Long,sAs StringOn Error GoToErr_HandlerIflcid= 0Then Exit Functionn=GetLocaleInfoW(lcid,LOCALE_SLOCALIZEDDISPLAYNAME, 0, 0)Ifn> 0Thens=String$(n,vbNullChar)GetLocaleInfoW lcid,LOCALE_SLOCALIZEDDISPLAYNAME,StrPtr(s),nGetFullLanguageDisplayName=Left$(s,n- 1)End IfExit_Handler:Exit FunctionErr_Handler:GetFullLanguageDisplayName=vbNullStringResumeExit_HandlerEnd Function
Windows Language Code
Code very similar to that used for the Office language is used with the GetUserDefaultUILanguage API to obtain the Windows language for the current user.
'###### Windows Language functions ###########Public FunctionGetWinUserDefaultUILanguageEnum()'This gives the Windows user language enum from the APIGetWinUserDefaultUILanguageEnum=GetUserDefaultUILanguage()End FunctionPublic FunctionGetWindowsLanguage()'Get the Windows user language / locale e.g. English UKGetWindowsLanguage=Nz(DLookup("Language", "tblMsoLang", "MsoLangValue = "&GetWinUserDefaultUILanguageEnum), "")End FunctionPublic FunctionGetCurrentWinLangCode()'get current Windows lang code e.g. enGetCurrentWinLangCode=Nz(DLookup("LangCode", "tblMsoLang", "MsoLangValue = "&GetWinUserDefaultUILanguageEnum), "")End FunctionPublic FunctionGetCurrentWinLanguage()'get current Windows language e.g. EnglishGetCurrentWinLanguage=Nz(DLookup("Language", "tblLanguages", "Code ='"&GetCurrentWinLangCode& "'"), "English")End Function
The attached app includes a form which uses several of the functions shown above.
The form buttons are used to display the information as new-style FluentUI messages. For example, the Get Full Access / Windows info button returns a message such as:
Download
The example app includes all objects and code used in this article:
Click to download: Office/Windows Language Code v1.1 Approx 0.6 MB (ACCDB - zipped)
As is the case for all files downloaded from the internet, first unblock the downloaded file, unzip it, then save to a trusted location.
For more details, see my article:
Unblock downloaded files by removing the Mark of the Web
Further Developments
The above code works well but depends on data stored in the table tblMsoLang. This will go out of date if Microsoft make additional Office languages available in the future.
An alternative API based approach completely eliminates the need for the data table. This code is explained in a separate article:
Get Office/Windows Language Info Using APIs
Feedback
Please use the Email button in the contact form below to let me know whether you found this article useful or if you have any questions.
Please also consider making a donation towards the costs of maintaining this website. Thank you
| Colin Riddington | Mendip Data Systems | Last Updated 23 Sept 2026 |
|---|
|
Return to Code Samples Page
|
Return to Top
|