Attribute VB_Name = "MVW4Language" Option Explicit Public Declare Sub keybd_event Lib "user32" _ (ByVal bVk As Byte, _ ByVal bScan As Byte, _ ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long _ ) Public Const KEYEVENTF_EXTENDEDKEY = &H1 Public Const KEYEVENTF_KEYUP = &H2 Public Declare Function GetKeyboardLayout Lib "user32" _ (ByVal dwLayout As Long _ ) As Long Public Declare Function ActivateKeyboardLayout Lib "user32" _ (ByVal HKL As Long, _ ByVal Flags As Long _ ) As Long Public Const HKL_NEXT = 1 Public Sub SetKeyboardLayout(ByVal LCID As Long) 'Sucht ein Tastaturlayout passend zur gewünschten Sprachkennung 'Eingabe: ' LCID: gewünschte Sprachkennung (Windows locale identifier) Dim lKbLayoutFirst As Long, lKbLayout As Long Dim lLCID As Long Dim f As Boolean f = False lKbLayoutFirst = GetKeyboardLayout(0) lKbLayout = lKbLayoutFirst 'alle installierten Keyboard-Layouts durchlaufen Do lLCID = lKbLayout And &HFFFF& If lLCID = LCID Then 'und bei passendem Layout Schleife verlassen und Einstellung beibehalten. f = True Exit Do End If ActivateKeyboardLayout HKL_NEXT, 0 lKbLayout = GetKeyboardLayout(0) Loop Until lKbLayout = lKbLayoutFirst If Not f Then MsgBox "No Keyboard Layout found!", vbInformation + vbOKOnly End If End Sub