switch languages with macro (solved)

ktab

Well-known Member
Joined
Apr 21, 2005
Messages
1,297
Hello,

I was wondering if there is some other way to switch language from english (my default) to greek (my second language) except application.sendkeys("+%") .... alt+shift

thank you
Kostas
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Ceduljko

Board Regular
Joined
Dec 28, 2004
Messages
58
Is this what you're looking for?

With Application.SpellingOptions
.DictLang = 1032
.UserDict = "CUSTOM.DIC"
End With

The list of language codes can be found on
http://www.microsoft.com/globaldev/nlsweb/

Or, are you thinking about changing the system default language (like via Control Panel)?
 

ktab

Well-known Member
Joined
Apr 21, 2005
Messages
1,297
I guess that this is what i'm looking for but it does not seem to work. To test it i made a userform with 2 buttons one with code 1032 (greek) and the other with the code 1033 (US English). Whenever i press these the language indicator by the task bar disappers, and language does not change. I will experiment with that myself, but if you have any ideas, are all welcome.
 

ktab

Well-known Member
Joined
Apr 21, 2005
Messages
1,297
I found this one, from here:http://www.mabat3.co.il/phpBB/viewtopic.php?topic=2759&forum=10&1


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

This changes languages to english and hebrew.
Does anyone know how these numbers like lang_Hebrew = 67961869 and english = 67699721 are calculated? Or even better where can i find the number for the lang_greek. No it's not &h8 or 408 i've tried these....
 

ktab

Well-known Member
Joined
Apr 21, 2005
Messages
1,297
Special thanks to Ido Ben Horin for this code:

Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Sub KeyboardLayout()
MsgBox GetKeyboardLayout(0)
End Sub

Run this macro while you have ****ched to desired language and it will reveal the keyboardlayout number
 

Watch MrExcel Video

Forum statistics

Threads
1,118,680
Messages
5,573,628
Members
412,539
Latest member
itchy00
Top