[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

move one pixel

Posted on 2016-11-01
4
Medium Priority
?
106 Views
Last Modified: 2016-11-01
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

Open in new window

0
Comment
Question by:wiredemc12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Expert Comment

by:pony10us
ID: 41868527
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
0
 

Author Comment

by:wiredemc12
ID: 41868532
Yes I have seen that, but I was looking to move the cursor in a loop.
0
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 41868540
Private dtmNext As Date
' Move cursor every 30 seconds
Sub Move_Cursor()
    Dim Hold As POINTAPI
    Do
    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"
    Loop
End Sub

' Stop moving cursor
Sub Stop_Cursor()
    Application.OnTime dtmNext, "Move_Cursor", , False
End Sub

Open in new window

0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 41868782
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question