Answer to Question #44102 in Other Programming & Computer Science for brian

Question #44102
I have 2 columns in Excel. Column 1 - its just plain English words like hello, food, fight, kick, etc. In column 2 - I have a list thats going to be for hebrew translation words. now Im trying to format column 2 to automatically type in hebrew letters via language bar. So in other words, I want column 2 to be able to write in hebrew without using a special 3rd party installed font. But rather just from the language bar thats already on a windows operating system. Can it be done?
Expert's answer
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:

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog