Word/Windows Language

J

jille

Hi,

I've written a macro in Word 2000 that will be used in 2 separate
environments: the first is an English version, the second is a French version
for users who are using the French version of Word and the French version of
Windows 2000.

I need to be able to determine which version of Word/Windows they are using
(not the Dictionary language): English or French.

I've had a look...so far all I've found relates to the dictionary. This
won't work since users in our environment typically activate multiple
dictionaries and users are able to generate documents in both languages from
my macro.

Please help!

Thanks,
Jille
 
K

Karl E. Peterson

jille said:
I need to be able to determine which version of Word/Windows they are using
(not the Dictionary language): English or French.

This oughta do it:

' Win32 Locale functions
Private Declare Function GetSystemDefaultLangID Lib "kernel32" () As Integer
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

' Localized name of language
Private Const SORT_DEFAULT As Long = &H0 ' sorting default
Private Const LOCALE_SLANGUAGE = &H2

Public Function LocaleLangauge(Optional LCID As Long) As String
Dim nRet As Long
Dim buf As String

' If user didn't provide an LCID, use
' current system default value.
If LCID = 0 Then
LCID = GetSystemDefaultLangID
End If

' Determine buffer requirement for language.
nRet = GetLocaleInfo(LCID, LOCALE_SLANGUAGE, buf, 0)
buf = Space$(nRet)

' Obtain language description.
Call GetLocaleInfo(LCID, LOCALE_SLANGUAGE, buf, Len(buf))
LocaleLangauge = TrimNull(buf)
End Function

Actually, you'd probably do best just querying for the LCID, and comparing it to
those you're willing/able to work with. See also:

List of Locale ID (LCID) Values as Assigned by Microsoft
http://www.microsoft.com/globaldev/reference/lcid-all.mspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top