Grrr! Endlich!
nScan = MapVirtualKey(VK, 2) ' unshifted
' Character Value in low-Order Word of Return Value. No Translation => 0
nExtended = 0 ' Preset Key
' for Switch
If nScan = 0 Then nExtended = KEYEVENTF_EXTENDEDKEY ' KeyDown Switch
nScan = MapVirtualKey(VK, 0) ' Hardware Scan
' Code. No Translation => 0
bShiftS = (VK And &H100) ' Capital
' Letter; add SHIFT Key; a second Flag must be set here to distinguish
' from Control Key
VK = (VK And &HFF) ' Reduce VK to
' lower Byte
' Press Shift Key for single Character only if Shift Key for String isn't _
set
If Not bShift And bShiftS Then keybd_event VK_SHIFT, 0, 0, 0
' Press and release Character resp. Special Key
keybd_event VK, nScan, nExtended, 0
keybd_event VK, nScan, KEYEVENTF_KEYUP Or nExtended, 0
' Release Shift Key for single Character only if Shift Key for String
' isn't set
If Not bShift And bShiftS Then
keybd_event VK_SHIFT, 0, KEYEVENTF_KEYUP, 0
bShiftS = False
End If
Next J
' Release Control Key(s) after last (as may be only one) Repetition of String
If bRep Then
If bShift And bShiftd Then
keybd_event VK_SHIFT, 0, KEYEVENTF_KEYUP, 0
bShift = False ' Reset Flags
bShiftd = False
End If
If bCtrl And bCtrld Then
keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0
bCtrl = False
bCtrld = False
End If
If bAlt And bAltd Then
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
bAlt = False
bAltd = False
End If
End If
End Sub ' SendKeysEx
Function IsNumber(CString As String) ' Check String
' whether only Numbers occur
Dim Nr As Integer, CAsc As String
For Nr = 1 To Len(CString)
CAsc = Asc(Mid(CString, Nr, 1))
If CAsc < 48 Or CAsc > 57 Then
Exit Function
End If
Next
IsNumber = True
End Function ' IsNumber
Sub Kdebug(Msg As String)
Debug.Print Msg
Debug.Print "bshift : " & bShift & vbTab & "bCtrl : " & bCtrl & vbTab & "bAlt :" & _
"" & bAlt
Debug.Print "bshiftd: " & bShiftd & vbTab & "bCtrld: " & bCtrld & vbTab & _
"bAltd: " & bAltd & vbLf
End Sub
Sub test()
Dim strTest As String
Worksheets("Tabelle1").Activate
strTest = Cells(1, 10)
Cells(12, 10).Select
SendKeyStr strTest
End Sub Das muß doch irgendwie gehen! |