Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing language of application Alfredo_CPA Setting up and Configuration of Excel 10 October 16th 08 02:14 AM
How to change German language data into Eglish Language in a colum Execel work sheet language problems Excel Discussion (Misc queries) 1 October 29th 07 09:59 PM
How to Determine if Application Window Still Active Edwin Kelly Excel Discussion (Misc queries) 3 June 26th 07 05:42 PM
language support in excel sheet using a third party language tool seema Excel Worksheet Functions 0 March 13th 06 06:06 AM
How to change the excel format from language to language? zee Excel Discussion (Misc queries) 2 January 30th 05 06:51 PM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"