cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the selected language in VBA code ?

Former Member
0 Kudos

Hello,

I'm using the BEx Analyzer on BI 7.

The user can select the language when connecting. But then how can I get the selected language in VBA, in order to do some VLOOKUP in my excel sheets, regarding the user language ?

Thanks a lot,

Remi

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Any idea ?

Former Member
0 Kudos

Hi Rémi,

Did you get any solution to your problem??

I have got the same issue as you!

Thanks in advance!!

Former Member
0 Kudos

Hi Ivan,

I didn't find a solution to pick up the language directly from a SAP variable...

So I used an old taltic : I pick up the language through the windows registry

Here is my VBA code to do it :


Public Function Get_User_Language() As String
   Dim oShell As Object
   Dim strDefaultSysID As String

   On Error GoTo ErrorHandler
     
   Set oShell = CreateObject("Wscript.Shell")
   strDefaultSysID = oShell.RegRead("HKCUSoftwareSAPSAPLogonDefaultSystemID")
   If strDefaultSysID = "" Then GoTo ErrorHandler
   Get_User_Language = oShell.RegRead("HKCUSoftwareSAPSAPLogonSystems" & strDefaultSysID & "Language")

EndFunction:
   Set oShell = Nothing
   Exit Function
ErrorHandler:
   MsgBox "Error when getting the user language. Be sure to have selected a default system. English selected.", vbInformation
   Get_User_Language = "EN"
   GoTo EndFunction
End Function

Warning :

This code works only if you've ticked the option "Use selected System as Default" in the SAP logon dialogbox.

Have a good day,

Rémi