wiredemc12
asked on
move one pixel
Will this code work to move the cursor every 30 seconds infinite? If not is it possible to amend this code to move the cursor every 30 seconds with an infinite loop?
Private dtmNext As Date
' Move cursor every 30 seconds
Sub Move_Cursor()
Dim Hold As POINTAPI
GetCursorPos Hold
SetCursorPos Hold.X_Pos + 30, Hold.Y_Pos
Application.Wait DateAdd("s", 1, Now)
SetCursorPos Hold.X_Pos, Hold.Y_Pos
dtmNext = DateAdd("s", 30, Now)
Application.OnTime dtmNext, "Move_Cursor"
End Sub
' Stop moving cursor
Sub Stop_Cursor()
Application.OnTime dtmNext, "Move_Cursor", , False
End Sub
There was a similar question asked a few years ago that used a loop that you could adapt for your needs. https://www.experts-exchange.com/questions/28342365/Word-2010-VBA-Move-the-cursor-one-character-to-the-right-every-2-seconds.html
ASKER
Yes I have seen that, but I was looking to move the cursor in a loop.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm glad I was able to help.
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015