# VBA - KeyPress Event



## Flashbond (Dec 16, 2022)

Hi,

I swear I am not trying to make a key logger.

Regarding the post below, I want to get the last interaction time as variable on any mouse move or key press.

There are zillion of examples regarding Application.OnKey or GetAsyncKeyState but both requires a certain key as an argument. At least that's what I understand...

Can some one write a simple VBA code for any key press event that will pop up msgbox which says "Any key pressed"? I don't want the key code or I don't want to log it. Just a simple event listener.

Thanks a lot!








						VBA code to check inactivity on a sheet and display an alert
					

I have been doing some digging for a while now and I have come across cool stuffs concerning what I want to achieve.  The only setback is that they are scattered all over in bits.  So I came across this code from @Tom Urtis which tacks the movement of the mouse.   Public Declare Function...




					www.mrexcel.com


----------

