Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine application language in Excel 97
Hi,
I have an application in which I need to detect the language version of the Excel installation. To do this I use: application.LanguageSettings.LanguageID(msoLanguag eIDUI) The problem is that some of the users have Excel 97 which doesn't seem to support the LanguageSettings method. Is there a method of determining the language version of Excel that will work on all versions for 97 through 2003? Thanks Paul |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine application language in Excel 97
Paul,
Here is another way. Put this code in a general module and access with msgbox GetLanguageName() '--------------------------- Private Declare Function GetThreadLocale Lib "kernel32" () As Long Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long Private Declare Function GetLocaleInfo Lib "kernel32" _ Alias "GetLocaleInfoA" _ (ByVal Locale As Long, _ ByVal LCType As Long, _ ByVal lpLCData As String, _ ByVal cchData As Long) As Long Const LOCALE_ILANGUAGE As Long = &H1 'language id Const LOCALE_SLANGUAGE As Long = &H2 'localized name of lang Const LOCALE_SENGLANGUAGE As Long = &H1001 'English name of lang Const LOCALE_SABBREVLANGNAME As Long = &H3 'abbreviated lang name Const LOCALE_SNATIVELANGNAME As Long = &H4 'native name of lang Const LOCALE_ICOUNTRY As Long = &H5 'country code Const LOCALE_SCOUNTRY As Long = &H6 'localized name of country Const LOCALE_SENGCOUNTRY As Long = &H1002 'English name of country Const LOCALE_SABBREVCTRYNAME As Long = &H7 'abbreviated country name Const LOCALE_SNATIVECTRYNAME As Long = &H8 'native name of country Const LOCALE_SINTLSYMBOL As Long = &H15 'intl monetary symbol Const LOCALE_IDEFAULTLANGUAGE As Long = &H9 'def language id Const LOCALE_IDEFAULTCOUNTRY As Long = &HA 'def country code Const LOCALE_IDEFAULTCODEPAGE As Long = &HB 'def oem code page Const LOCALE_IDEFAULTANSICODEPAGE As Long = &H1004 'def ansi code page Const LOCALE_IDEFAULTMACCODEPAGE As Long = &H1011 'def mac code page Const LOCALE_IMEASURE As Long = &HD '0 = metric, 1 = US '#if(WINVER = &H0400) Const LOCALE_SISO639LANGNAME As Long = &H59 'ISO abbreviated language name Const LOCALE_SISO3166CTRYNAME As Long = &H5A 'ISO abbreviated country name '#endif /* WINVER = as long = &H0400 */ '#if(WINVER = &H0500) Const LOCALE_SNATIVECURRNAME As Long = &H1008 'native name of currency Const LOCALE_IDEFAULTEBCDICCODEPAGE As Long = &H1012 'default ebcdic code page Const LOCALE_SSORTNAME As Long = &H1013 'sort name '#endif /* WINVER = &H0500 */ Dim LCID As Long '--------------------------------------------------------------------------- Public Function GetUserLocaleInfo(ByVal dwLocaleID As Long, ByVal dwLCType As Long) _ As String '--------------------------------------------------------------------------- Dim sReturn As String Dim r As Long 'call the function passing the Locale type 'variable to retrieve the required size of 'the string buffer needed r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn)) 'if successful.. If r Then 'pad the buffer with spaces sReturn = Space$(r) 'and call again passing the buffer r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn)) 'if successful (r 0) If r Then 'r holds the size of the string 'including the terminating null GetUserLocaleInfo = Left$(sReturn, r - 1) End If End If End Function '--------------------------------------------------------------------------- Public Function GetLanguageName() '--------------------------------------------------------------------------- LCID = GetSystemDefaultLCID() GetLanguageName = GetUserLocaleInfo(LCID, LOCALE_SENGLANGUAGE) End Function -- HTH RP (remove nothere from the email address if mailing direct) "Paul" wrote in message ... Hi, I have an application in which I need to detect the language version of the Excel installation. To do this I use: application.LanguageSettings.LanguageID(msoLanguag eIDUI) The problem is that some of the users have Excel 97 which doesn't seem to support the LanguageSettings method. Is there a method of determining the language version of Excel that will work on all versions for 97 through 2003? Thanks Paul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing language of application | Setting up and Configuration of Excel | |||
How to change German language data into Eglish Language in a colum | Excel Discussion (Misc queries) | |||
How to Determine if Application Window Still Active | Excel Discussion (Misc queries) | |||
language support in excel sheet using a third party language tool | Excel Worksheet Functions | |||
How to change the excel format from language to language? | Excel Discussion (Misc queries) |