+ Reply to Thread
Results 1 to 15 of 15

Move Mouse Pointer

  1. #1
    Registered User
    Join Date
    07-11-2014
    Location
    Sin city
    MS-Off Ver
    MS Office Pro Plus 2010
    Posts
    41

    Move Mouse Pointer

    Hi,

    As the title says, can someone please share a VBA macro (for Excel 2016) that will move the mouse pointer by 1 pixel every 1 minute even when the PC is locked?

    Thank you!

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Move Mouse Pointer

    .
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-11-2014
    Location
    Sin city
    MS-Off Ver
    MS Office Pro Plus 2010
    Posts
    41

    Re: Move Mouse Pointer

    Thank you for the code. I have tried your code and for some reason it does not seem to work. We have a tracking software for employees installed on our workstations which shows the idle time, total time, etc. I have used the above code and ran the macro, locked the PC. After 5 mins, I unlock the PC and check the tracking software and it shows the idle time as 5 mins. I want to bypass this so the software does not track any idle time.

    The steps I followed are Open Excel > Alt + F11 > Right click on Sheet1 (top left bar) > Right click > Insert > Module > Paste the above code > Ctrl + S > Save in xlsm format. To run, I open the macro file > View > Macros > Select the macro > Run

    I will continue to test this code for some more time and give feedback. In the meantime, may I ask if I need to reduce the time from 1 min to every 20 secs and update from 1 pixel to 20 pixels in the above code, then what change will I need to make? Thank you!

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Move Mouse Pointer

    .
    Try this edited macro. It will keep track of each time the mouse has moved.

    Please Login or Register  to view this content.
    See attached file ....

    I don't believe you will need to adjust the timing or the distance of the cursor move. Just so long as the cursor/mouse pointer does move is all that
    should be necessary. The attached workbook will write to COL A / SHEET1 the date/time each time the cursor moves. If there are no inputs to COL A
    that will be the indication that locking down the computer terminates the execution of the macro.
    Attached Files Attached Files
    Last edited by Logit; 08-24-2018 at 10:18 PM.

  5. #5
    Registered User
    Join Date
    07-11-2014
    Location
    Sin city
    MS-Off Ver
    MS Office Pro Plus 2010
    Posts
    41

    Re: Move Mouse Pointer

    Thank you for the updated macro. I can confirm that this new macro works as I am seeing entries in the sheet 1 with the time. However, the tracking software still captures the idle time when I lock my PC. Any suggestions?

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Move Mouse Pointer

    .
    Not certain I understand the goal.

    Even with the macro running (post #4), there is going to be one minute of idle time between cursor movements. I would suggest your tracking software is running correctly.

  7. #7
    Registered User
    Join Date
    07-11-2014
    Location
    Sin city
    MS-Off Ver
    MS Office Pro Plus 2010
    Posts
    41

    Re: Move Mouse Pointer

    Ok, let me clarify. The new macro runs for sure but the tracking software that is installed on our workstations still tracks the idle time (that is, the time since we locked and then later unlocked our PC). I run the new macro, locked my PC and after a break of 10 mins, I return and unlock my PC and the tracking software shows the idle time as 10 mins even though the macro runs correctly. May be the software detects screen lock?

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Move Mouse Pointer

    I'd put my mortgage on it detecting screen lock - isn't the software correct, you aren't working at your computer when it's locked (not that I agree with this type of management)

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Move Mouse Pointer

    .
    Did some searching on the net. Found several sites where others have tried to do what you are wanting. Their findings indicate
    when you "lock" the computer the idle time is still tracked. So ... locking the computer won't work unless you are willing to step
    through a bunch of API calls / hoops (there was one site that claimed to have a workaround using API calls). API calls "can" be
    lethal under certain circumstances - really mess up your computer.

    Perhaps a different approach is needed to reach your goal? How about blanking out or dimming the screen via VBA and
    locking down the screen/workbook which would require a password or key combo to unlock ? Is that a possibility ?

  10. #10
    Registered User
    Join Date
    07-11-2014
    Location
    Sin city
    MS-Off Ver
    MS Office Pro Plus 2010
    Posts
    41

    Re: Move Mouse Pointer

    Quote Originally Posted by Logit View Post
    .
    Did some searching on the net. Found several sites where others have tried to do what you are wanting. Their findings indicate
    when you "lock" the computer the idle time is still tracked. So ... locking the computer won't work unless you are willing to step
    through a bunch of API calls / hoops (there was one site that claimed to have a workaround using API calls). API calls "can" be
    lethal under certain circumstances - really mess up your computer.

    Perhaps a different approach is needed to reach your goal? How about blanking out or dimming the screen
    Thanks for your response. I think I would not prefer the first option (API calls, etc) which could impact the computer. Wanted to know more about the 2nd option that you have mentioned before proceeding with that. When you say blanking out/dimming the screen, do you mean that the system would actually be unlocked and one would only see a black screensaver on the screen?

    Locking down the screen/workbook which would require a password or key combo to unlock?
    - As the screen is again locked, I suppose the tracking software would again track the idle time? In this case, can you explain a little more as to how exactly would this work?

    Sorry to be a pain but just clarifying. Thank you!

  11. #11
    Registered User
    Join Date
    07-11-2014
    Location
    Sin city
    MS-Off Ver
    MS Office Pro Plus 2010
    Posts
    41

    Re: Move Mouse Pointer

    One other thing that I wanted to add after checking for some more time is that the tracking software installed on my workstation does not consider just the mouse pointer movement. That is, even if I am logged in and just move my mouse and not anything else (minimize, maximize windows, type, select, etc.), the tracking software still sees this as idle time. Therefore, even if I just move the mouse for 5 mins, I am seeing the idle time is 5 mins in the tracking software. I suppose, it looks at other things apart from just mouse pointer moving. Can we include a couple of "goodies" in our macro that will not just move the mouse but also do things like : write, select some value in the sheet?

    One other thing I noticed was that when I run your macro sheet and later when I stop it after sometime, I get an error (attached). Can you please take a look at this. Thank you!
    Attached Images Attached Images

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Move Mouse Pointer

    .
    I've re-read your original post several times to make certain I understand what the goal is. I have previously misunderstood that goal.

    See if this macro will do the job. In essence, when initiated it runs every second - hopefully this is sufficient to trick your program into believing
    there was no or very little inactivity.

    The macro selects cell A1. Then every second it "presses" the LEFT ARROW key. Since A1 is the active cell, the cursor remains in A1 and the code
    continually selects A1 each time the macro circles through itself. The cursor "goes no where".

    You can have two command buttons on the sheet - One to START and the other to STOP the macro.

    Attach the START button to" ScheduleclrCol " macro.
    Attach the STOP button to " manual_stop " macro.

    Let me know if this works ...


    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-11-2014
    Location
    Sin city
    MS-Off Ver
    MS Office Pro Plus 2010
    Posts
    41

    Re: Move Mouse Pointer

    Thank you for the updated code. May I ask that you please attach the updated code as a .xlsm file as I am a noob with this I will then test your updated macro and let you know if it works. Thanks again and have a great weekend!

  14. #14
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Move Mouse Pointer

    .
    Sorry I didn't attach the file previously. Here it is :
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-19-2019
    Location
    india
    MS-Off Ver
    2013
    Posts
    18

    Re: Move Mouse Pointer

    In this code mouse will move to some coordinates. Macro stops when mouse pointer has moved once, Can we move pointer to a specific coordinates and then it should move to another coordinates, and then it should go to previous coordinates. This should happen at an interval of 10 seconds or so and the loop should never stop until stopped manually.
    Please suggest modifications in code.


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mouse Pointer over Listbox
    By georgedeb4 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-12-2013, 11:56 AM
  2. [SOLVED] Userform and mouse pointer
    By Shawn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2006, 04:50 PM
  3. Mouse Pointer in Graph
    By James Hamilton in forum Excel General
    Replies: 0
    Last Post: 05-28-2006, 08:35 PM
  4. mouse pointer as a hand
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-26-2006, 09:30 AM
  5. [SOLVED] move mouse pointer to a default button(Enter) in messagebox
    By x taol in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2006, 08:20 AM
  6. mouse pointer . . . again!
    By lightbulb_bill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2005, 07:05 PM
  7. mouse pointer question
    By lightbulb_bill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2005, 05:05 PM
  8. Customize Mouse Pointer
    By AWOL in forum Excel General
    Replies: 1
    Last Post: 04-22-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1