Hello,
I have a workbook - Book1.xlsb.
Is it possible to run a macro only if the workbook is active AND there is no mouse movement? Const idleTime doesn't include mouse movement.
Thanks
Hello,
I have a workbook - Book1.xlsb.
Is it possible to run a macro only if the workbook is active AND there is no mouse movement? Const idleTime doesn't include mouse movement.
Thanks
Hi, Subject_Name_Here,
maybe you should indicate the action to be taken from the macro. From what I read you may want to close the workbook after a certain time of inactivity (the variable idleTime may be used for that). So the OnTime may be called from ThisWorkbook and either the Workbook_SheetChange or Workbook_SheetSelectionChange events as well.
Ciao,
Holger
Use Code-Tags for showing your code: [code] Your Code here [/code]
Please mark your question Solved if there has been offered a solution that works fine for you
Yes, the action would be to call macro2. Very simple. I'm just not sure if or how VBA would detect no mouse movement.
Hi, Subject_Name_Here,
AFAIR the mouse movement directly could only be monitored by using API. If a user works in a workbook there should either be a Selection of a new cell by scrolling or directy choosing a cell (causing the Workbook_SheetSelectionChange event to trigger) or any entry or change to a cell (that would call the Workbook_SheetChange). Both events should be placed in ThisWorkbook (or DieseArbeitsmappe in the german version). Calling the macro from these events would also cover the workbook to be placed in the tray.
If you need help on how to place the code you could have a look at this german site where you may download sample files which are commented.
HTH,
Holger
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks