RSRHP
01-23-2009, 11:55 AM
Hi
I need to know how to get the language version of MS Excel. Can anyone help me?
Thanks in advance
Bob Phillips
01-23-2009, 12:25 PM
It is an OS setting, so I think it would be tricky.
Bob Phillips
01-23-2009, 12:31 PM
This might do it for you
Public Const LOCALE_SENGLANGUAGE As Long = &H1001
Public Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Public 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
Public Function GetUserLocaleInfo(ByVal dwLocaleID As Long, _
ByVal dwLCType As Long) As String
Dim sReturn As String
Dim r As Long
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
If r Then
sReturn = Space$(r)
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
If r Then
GetUserLocaleInfo = Left$(sReturn, r - 1)
End If
End If
End Function
Sub testit()
MsgBox GetUserLocaleInfo(GetSystemDefaultLCID(), LOCALE_SENGLANGUAGE)
End Sub
RSRHP
01-24-2009, 12:56 AM
Thanks a lot xld. It works.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.