Skip to Content
author's profile photo Former Member
Former Member

How to get the selected language in VBA code ?

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2008 at 06:45 PM

    Any idea ?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ivan Lopez

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.