Excel canchange the input language using VBA and Windows API. Let’s assume that Hebrew
text is located in column B.
Then themacro to change input language in column B woul look like:
Private DeclareFunction ActivateKeyboardLayout Lib "user32" (ByVal myLanguage As
Long, Flag As Boolean) As Long 'function to changelanguage
Private SubWorksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Intersect(Target,Range("B:B")) Is Nothing Then 'if userclicks column B
Call ActivateKeyboardLayout(1037, 0) 'Hebrew language code is 1037
Else'if userclicks any other column
Call ActivateKeyboardLayout(1033, 0) 'English language code is 1033
End If
End Sub
This code is intended torun on x64 version of the Windows OS. If you are using x32 version, then Lib "user32" shouldbe changed to Lib "user32.dll". You can find numerical ID`s for other languages bythis link:
https://www.trigeminal.com/frmrpt2dap.asp
Comments
Leave a comment