I have the following problem... I would like to catch the keypresses while standing in Excel on a sheet, because I would like to use it for setting an autofilter on and searching in a sheet, which I am going to use as a phonebook. I have the following code for starting a timer.
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimer As Long) As Long
Private Const MY_NID = 88
Private Const MY_ELAPSE = 100
Dim rVal As Long
rVal = SetTimer(0, MY_NID, MY_ELAPSE, _
Dim i, KeyResult As Integer
For i = 0 To 255
KeyResult = GetAsyncKeyState(i)
If KeyResult = -32767 Then
If i = 122 Then
My problem is that GetAsyncKeyState(i) gives me an error and Excel crashes. I hope someone inhere has an idear on howto make my idear work.