Identifying the Office UI Language Settings

The first step in creating a multilingual application is to identify the user's settings. You can identify the language chosen in Windows Regional Settings by using Application.International (xlCountrySetting), which returns a number that corresponds approximately to the country codes used by the telephone system (1 is the USA, 44 is the UK, 47 is Norway, and so forth).

You can also use Application.International(xlCountryCode) to retrieve the user interface language using the same numbering system. This method has worked well in previous versions of Excel, where there were only 30 or so languages from which to choose your copy of Office.

Beginning with Office 2000, things have changed a little. By moving all the language configuration into separate language packs, Microsoft can support many more languages with relative ease. If you use the Object Browser to look at the msoLanguageID constants defined in the Office object library, you'll see that there are more than 180 languages and dialects listed.

You can use the following code to find out the exact Office UI language, and then decide whether you can display your application in that language or a similar language, or revert to a default language (as shown in the following section):

lLanguageID = Application.LanguageSettings.LanguageID(msoLanguageIDUI)

0 0

Post a comment