Or create your own Excel file by reading the text below (and copy / paste the vba code)
Why?
First it was a private joke, with this article it’s now a public joke.
Our client switched from Skype to Teams and it was a very cool improvement. My colleagues told me with a bit of fun: “Teams is cool, but you can’t change the time before appearing away!”. And it’s true, we can’t! Somebody said, “If you install a software who will click randomly on your screen, you will not appear away anymore”. Yes,.. but our software policy does not allow us to install anything on our computers.
It gave me an idea! Thanks to our very good old friend, Excel! People will say “Lazy is smart”, Arnaud is “funny” or any other reason. But I had fun with Excel and his perfect VBA editor.
My colleague Isabelle (and also Maslow) will say :

My hammer is Excel and Code.. I agree.. (nail or snail.. it’s just a “s” who is missing)
I created a small excel sheet who will loop until you ask it to finish and will move your mouse cursor every 5 seconds.
My joy is shared between.
“I’m the Microsoft BI guy who uses Microsoft Office and VBA code to do a joke”.
and
“People will see me as a very lazy guy!! isn’t the name of his website!?!”.
Anyway, if you read this article, then it’s because I think you will pick the first idea. I’m I wrong? 🙂
Where can you download it?
You can download the excel sheet on my github repo.
(If you want your own excel sheet, the code is also available at the end of this post)
Thanks to Rafi for his 64 bits version!
How does it look like?

This is how it looks in Excel. You can start the timer by clicking on the start button or CTRL + l (like lazysnail) or start manually the macro named “DoNotSleep”.
To stop the timer, you have to press any key.
Do you have the VBA code?
If you are curious and want to build your own Excel, let’s copy the following VBA code:
Public Declare PtrSafe Function SetCursorPos Lib "user32" (ByVal x As LongPtr, ByVal y As LongPtr) As LongPtr Public Declare PtrSafe Sub mouse_event Lib "user32" (ByVal dwFlags As LongPtr, ByVal dx As LongPtr, ByVal dy As LongPtr, ByVal cButtons As LongPtr, ByVal dwExtraInfo As LongPtr) Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Public Const MOUSEEVENTF_RIGHTDOWN As LongPtr = &H8 Public Const MOUSEEVENTF_RIGHTUP As LongPtr = &H10 Sub DoNotSleepPlease() Dim i As Integer For i = 1 To 9999 'For Info, number of iteration 'Cells(1, 1) = i If Cells(3, 5) = "" Then SetCursorPos 200, 200 'x and y position mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 WaitPlease SetCursorPos 300, 300 'x and y position mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 WaitPlease SetCursorPos 400, 400 'x and y position mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 WaitPlease SetCursorPos 500, 500 'x and y position mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 WaitPlease Else Exit For End If Next i End Sub Sub WaitPlease() Dim sngWaitEnd As Single sngWaitEnd = Timer + 5 Do DoEvents Cells(3, 3).Value = Timer Loop Until Timer >= sngWaitEnd End Sub
Arnaud, this is amazing. I have no need of such tool as I’m always moving my cursor anyway… but might send it to a few friends!
I have issues getting this to work in my 64 bit system. I get the following error code. Could you possible change the script to work for both 32 and 64?
Compile error:
The code in this project must be updated for use on 64-bit systems.
Please review and update Declare statements and then mark them with the PtrSafe attribute.
Hi Emelia,
replace the first 6 lines of code with the code I pasted down below. I had the same issue and now its gone.
CODE FOR 64bit:
Public Declare PtrSafe Function SetCursorPos Lib “user32” (ByVal x As LongPtr, ByVal y As LongPtr) As LongPtr
Public Declare PtrSafe Sub mouse_event Lib “user32” (ByVal dwFlags As LongPtr, ByVal dx As LongPtr, ByVal dy As LongPtr, ByVal cButtons As LongPtr, ByVal dwExtraInfo As LongPtr)
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_RIGHTDOWN As LongPtr = &H8
Public Const MOUSEEVENTF_RIGHTUP As LongPtr = &H10
Thank you Rafi, I did a change in the post and uploaded a new version! 🙂
don’t work on my computer.. 🙁
The 1st issue, when I try to use the code paste, is :
-> “Public Const MOUSEEVENTF_xxxxx = &Hx” is in red by VBA
The 2nd issue, when I replace “Public Const MOUSEEVENTF_xxxxxx = &Hx” by “Public MOUSEEVENTF_xxxxxx As LongPtr”,
is :
“Compile error:
Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules”
I’m not a chief in VBA.. Could you help me please ??
Many thanksss
Hi,May I ask why the program can stop if we press any key? Thanks!
how can you set a predetermined amount of minutes to end
code does not work.
Lines 3,4,5, and 6 are in red and throwing out errors