Changing Language ...

  • Hi,

    As you might know, we in Israel use 2 languages: English and Hebrew.

    Hebrew is written from right to left.

    On the Windows Task-Bar we have an Icon EN/HE.

    From within Excel we can change language with ALT+LEFT SHIFT.

    We usually use EN, especially in Excel because all functions are in EN.
    Therefore and unfortunately, the cursor in an InputBox (in Excel VBA)
    is placed Left justified and in EN.

    I tried to record a Macro while changing the language from EN to HE and right justifying the cursor with RIGHT CTRL+SHIFT.

    I succeeded un doing it BUT NO CODE was recorded for these steps.

    so, is there a way to put some code commands in order to achieve my request.

    I Hope I made myself clear.

    Thanks, Michael

    P.S. I do not want to change the default language !
    At the end of the Macro I would like to change the language back to EN !

  • Is this what you need?

    ActiveWorkbook.Windows(1).DisplayRightToLeft = True

    BTW, this assumes you have the Hebrew version of Excel, even if your primary language is English.

    Software: OpenOffice 3.0/NeoOffice 3.0 on Mac OS X 10.5.6
    Humanware: Older than dirt

    Old, slow, and confused - but at least I'm inconsistent!

    (retired Excel 2003 user, 3.28.2008)

  • Thanks for trying but unfortunatelly not...

    I am familiar with the command you provided.
    It changes the side of the A,B,C columns.

    In the Hebrew Excel version the A column is located in the far right of the screen and the command you wrote changes it to the English version where the A column is at the far left.

    Anyhow, (and it might be difficult for you to understand because most of the languages are written from left to right - only Arabic and Hebrew are from right to left) what I need is a code that changes the LANGUAGE from EN to HE and RIGHT JUSTIFIES the cursor with as if the combination RIGHT CTRL+SHIFT was used.

    Thanks, Michael

  • in a second thought . . .

    maybe you can provide me with 2 commands which emulates:

    ALT + LEFT SHIFT (for changing the language).


    RIGHT CTRL + SHIFT (for changing the justifying side).

    Thanks, Michael

  • For the latter you could put this into a Macro and then using the Tools...Macro menu item assign it a key stroke.

    ActiveSheet.Cells.HorizontalAlignment = xlRight

    However it is not possible to differentiate between either the left/right alt,shift, or control keys.

    Not sure how to accomplish the prior language change.


  • Michael,

    One possible way you could get to switch between the languages is by using SendKeys. I havent used these for a while so you may need to get some help from some of the others but here goes...



    PS if you want to test the code you have to run it you cannot use debug mode to test it.

  • Hello Michael,
    See if the code below can help.
    I didn't try it but it was publishe by Ido from Mabat3.

    Private Const KLF_REORDER = &H8
    Private Const lang_Hebrew = 67961869
    Private Const lang_English = 67699721

    Private Declare Function ActivateKeyboardLayout Lib "user32" (ByVal HKL As Long, ByVal flags As Long) As Long

    Sub English()
    Call ActivateKeyboardLayout(lang_English, KLF_REORDER)
    End Sub

    Sub Hebrew()
    Call ActivateKeyboardLayout(lang_Hebrew, KLF_REORDER)
    End Sub

  • Thanks everybody especially AO. . .

    Well... this might be a good lesson that one should first check in his "backyard" before looking "overseas" !

    The code, indeed, changes between the languages BUT the typing (the cursor) stays left justified.

    So, I am still curious as how the typing(!) direction can be altered from left2right and vise versa with a code ?


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!