Code Samples for Businesses, Schools & Developers

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:

SysCmd 720
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:

Language Options
The preferred language specified here will apply to all Office apps but requires Office to be restarted.

RestartOfficeMsg
NOTE: Before you can use a language in Office, the related language pack must be installed from Windows Settings|Language:

Windows Language Settings
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.

Registry Language Resources
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:

Language Settings
We will be using the LanguageID property (msoAppLanguageID)

msoAppLanguageID
The msoAppLanguageID property is a constant used to return locale identifier (LCID) information to the specified application. See MsoLanguageID enumeration (Office)

msoAppLanguageID Enumeration
Each of these items will return a constant value representing one of the 216 available Office languages e.g. msoLanguageIDEnglishUK = 2057, msoLanguageIDGerman = 1031.

msoLanguageID
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:

Office Language Code
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.

Table tblMsoLang
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 user
Private Declare PtrSafe Function GetUserDefaultUILanguage Lib "kernel32.dll" () As Long

Public strLocale As String, strLangCode As String, strOfficeLang As String, strOfficeLangCode As String

Function GetLocale(ByVal lngCode) As String

On Error GoTo Err_Handler

GetLocale = Nz(DLookup("Language", "tblMsoLang", "MsoLangValue = " & lngCode), "")

Exit_Handler:
Exit Function

Err_Handler:
MsgBox "Error " & Err.Number & " in GetLocale procedure:" & vbCrLf & _
Err.Description, vbCritical, "GetLocale error"
Resume Exit_Handler
End Function


The following functions are used with GetLocale and LanguageSettings.LanguageID to obtain various Office language related items:

'######### Office Language functions #########

Public Function GetCurrentOfficeLanguageEnum()
'get current Office language enum e.g. 2057 (for English UK)
GetCurrentOfficeLanguageEnum = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
End Function

Public Function GetCurrentOfficeLanguage()
'get current Office language e.g. English UK
GetCurrentOfficeLanguage = GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDUI))
End Function

Public Function GetCurrentOfficeLangCode()
'get current Office lang code e.g. en
GetCurrentOfficeLangCode = Nz(DLookup("LangCode", "tblMsoLang", "Language ='" & GetCurrentOfficeLanguage & "'"), "")
End Function

Public Function GetCurrentLanguage()
'get language in tblLanguages corresponding to current Office lang code e.g. English
GetCurrentLanguage = Nz(DLookup("Language", "tblLanguages", "Code ='" & GetCurrentOfficeLangCode & "'"), "")
End Function

Public Function GetOfficeHelpLanguage()
'get Office help language e.g. English US
GetOfficeHelpLanguage = GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDHelp))
End Function

Public Function GetOfficeInstallLanguageEnum()
'get Office install language enum e.g. 1033 (for English US)
GetOfficeInstallLanguageEnum = Application.LanguageSettings.LanguageID(msoLanguageIDInstall)
End Function

Public Function GetOfficeInstallLanguage()
'get Office install language e.g. English US
GetOfficeInstallLanguage = GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDInstall))
End Function

Public Function GetPreviousOfficeLanguageEnum()
'get previous Office language enum e.g. 1031 (for German)
GetPreviousOfficeLanguageEnum = Application.LanguageSettings.LanguageID(msoLanguageIDUIPrevious)
End Function

Public Function GetPreviousOfficeLanguage()
'get previous Office language e.g. German
GetPreviousOfficeLanguage = GetLocale(Application.LanguageSettings.LanguageID(msoLanguageIDUIPrevious))
End Function


The code in the next two procedures are examples which give message box output:

Sub GetLocaleInfo()
Dim lngCode As Long

'This gives current Office language as code and in words
lngCode = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
MsgBox "Locale Code: " & lngCode & vbCrLf & "Locale: " & GetLocale(lngCode), , "Current Office language"
End Sub

Sub OfficeInstallLanguage()
Dim lngCode As 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:

Access & VBE Menu Languages Different
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 Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" _
(ByVal lpModuleName As String) As LongPtr
Private Declare PtrSafe Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" _
(ByVal hModule As LongPtr, ByVal lpFilename As String, ByVal nSize As Long) As Long

'https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfow
Private Declare PtrSafe Function GetLocaleInfoW Lib "kernel32" ( _
ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As LongPtr, _
ByVal cchData As Long) As Long

Private Const LOCALE_SLOCALIZEDCOUNTRYNAME As Long = &H6 'e.g. Spain
Private Const LOCALE_SLOCALIZEDDISPLAYNAME As Long = &H72 'Spanish (Spain, International Sort)
Private Const LOCALE_SLOCALIZEDLANGUAGENAME As Long = &H6F 'e.g. Spanish

' Returns the VBE Language Enum by identifying the folder name for VBE7INTL.DLL
Public Function GetVBELanguageEnum() As String

Dim hModule As LongPtr
Dim buffer As String * 260
Dim length As Long
Dim dllPath As String
Dim parts() As String

' Get handle of the VBE international resources DLL loaded in memory
hModule = GetModuleHandle("VBE7INTL.DLL")

If hModule <> 0 Then
length = GetModuleFileName(hModule, buffer, 260)
dllPath = Left(buffer, length)

' Debug.Print dllPath

' Path structure: ...\Microsoft Shared\VBA\VBA7.1\<LCID>\VBE7INTL.DLL
parts = Split(dllPath, "\")

' Return the folder name immediately preceding the DLL
If UBound(parts) >= 1 Then
GetVBELanguageEnum = parts(UBound(parts) - 1)
Exit Function
End If
End If

GetVBELanguageEnum = "Unknown"
End Function


Three further functions are used with the LCID value from GetVBELanguageEnum to obtain various VBE language related items:

'Returns the language name
Public Function GetLanguageName(lcid As Long) As String

Dim n As Long
Dim s As String

On Error GoTo ErrorHandler

If lcid = 0 Then Exit Function

n = GetLocaleInfoW(lcid, LOCALE_SLOCALIZEDLANGUAGENAME, 0, 0)

If n > 0 Then
s = String$(n, vbNullChar)

GetLocaleInfoW lcid, LOCALE_SLOCALIZEDLANGUAGENAME, StrPtr(s), n

GetLanguageName = Left$(s, n - 1)
End If

Exit Function

ErrorHandler:
GetLanguageName = vbNullString

End Function

'Returns the locale name
Public Function GetCountryName(lcid As Long) As String

Dim n As Long
Dim s As String

On Error GoTo Err_Handler

If lcid = 0 Then Exit Function

n = GetLocaleInfoW(lcid, LOCALE_SLOCALIZEDCOUNTRYNAME, 0, 0)

If n > 0 Then
s = String$(n, vbNullChar)

GetLocaleInfoW lcid, LOCALE_SLOCALIZEDCOUNTRYNAME, StrPtr(s), n

GetCountryName = Left$(s, n - 1)
End If

Exit_Handler:
Exit Function

Err_Handler:
GetCountryName = vbNullString
Resume Exit_Handler

End Function

'Returns the language and locale names
Public Function GetFullLanguageDisplayName(lcid As Long) As String

Dim n As Long, s As String

On Error GoTo Err_Handler

If lcid = 0 Then Exit Function

n = GetLocaleInfoW(lcid, LOCALE_SLOCALIZEDDISPLAYNAME, 0, 0)

If n > 0 Then
s = String$(n, vbNullChar)

GetLocaleInfoW lcid, LOCALE_SLOCALIZEDDISPLAYNAME, StrPtr(s), n

GetFullLanguageDisplayName = Left$(s, n - 1)
End If

Exit_Handler:
Exit Function

Err_Handler:
GetFullLanguageDisplayName = vbNullString
Resume Exit_Handler

End 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 Function GetWinUserDefaultUILanguageEnum()
'This gives the Windows user language enum from the API
GetWinUserDefaultUILanguageEnum = GetUserDefaultUILanguage()
End Function

Public Function GetWindowsLanguage()
'Get the Windows user language / locale e.g. English UK
GetWindowsLanguage = Nz(DLookup("Language", "tblMsoLang", "MsoLangValue = " & GetWinUserDefaultUILanguageEnum), "")
End Function

Public Function GetCurrentWinLangCode()
'get current Windows lang code e.g. en
GetCurrentWinLangCode = Nz(DLookup("LangCode", "tblMsoLang", "MsoLangValue = " & GetWinUserDefaultUILanguageEnum), "")
End Function

Public Function GetCurrentWinLanguage()
'get current Windows language e.g. English
GetCurrentWinLanguage = Nz(DLookup("Language", "tblLanguages", "Code ='" & GetCurrentWinLangCode & "'"), "English")
End Function


The attached app includes a form which uses several of the functions shown above.

Language Code Form
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:

Access/Windows Info Message


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