Any idea how to change system KEYBOARD LANGUAGE with vba

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MBMSOFT
    New Member
    • Apr 2010
    • 18

    Any idea how to change system KEYBOARD LANGUAGE with vba

    Any idea how to change system keyboard language with vba

    I tried changing keyboard property in the control property and it works

    but i need change in one control only, and if i change property it change for all contols after
    so i need code on exit control event to change the system keyboard language

    \e.g.
    *************** *************** *************** *******
    Private Sub A_Enter()

    Me.A.KeyboardLa nguage = 49

    End Sub

    Private Sub A_Exit(Cancel As Integer)

    Me.A.KeyboardLa nguage = 11

    'this works(it means that keyboard language for ctl is changed back on english - 11, but system keyboard language remain on 49)
    ' so i need here to change system keyboard language

    End Sub
    *************** *************** *************** ****
  • MBMSOFT
    New Member
    • Apr 2010
    • 18

    #2
    I found the way how to manage this issue , so if it is halpfull for someone here it is:

    Code:
    Private Declare Function ActivateKeyboardLayout Lib _
    "user32.dll" (ByVal myLanguage As Long, Flag As Boolean) As Long
    
    'define your desired keyboardlanguage
    'find your desired language at [url]http://www.trigeminal.com/frmrpt2dap.asp[/url]
    
    Private Const MKD = 1071 'macedonian keyboard language layout
    Private Const eng = 1033 'english(united states)keyboard language layout
    
    
    Private Sub A_Enter()
    
    Call ActivateKeyboardLayout(MKD, 0)
    
    End Sub
    
    Private Sub A_Exit(Cancel As Integer)
    
    Call ActivateKeyboardLayout(eng, 0)
    
    End Sub

    Comment

    Working...