ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Keeping excel visible (https://www.excelbanter.com/excel-programming/339546-keeping-excel-visible.html)

Mike K

Keeping excel visible
 
Oh Wise Ones,
Due to circumstances beyond my control I can no
longer view my excel constantly running macro for longer than 5 mins before
my screen saver kicks in. Is there an excel solution to simulate mouse
movement or keystroke events to satisfy windows screensaver so as to not
innitiate? If not, is there a non-excel solution? As I said, I cannot modify
the screensaver settings, all I can do is make it look like I'm doing
something within a 5 min span. Any help would be appriciated.

Thanks,
Mike

JoJo

Keeping excel visible
 

Have you tried moving your mouse in a corner part of the screen while
the macros are running just to keep the screensaver from kicking in.

Those bloody IT dudes. :rolleyes:
JoJo


--
JoJo
------------------------------------------------------------------------
JoJo's Profile: http://www.excelforum.com/member.php...o&userid=11307
View this thread: http://www.excelforum.com/showthread...hreadid=466067


Mike K

Keeping excel visible
 
To clarify, everything is fine if I'm at the computer mousing or keyboarding.
I need something to do these things for me when I'm accross the room or away
from the computer for more than 5 mins. Similar to "keep alive" programs for
dialup connections. A task schedular may work if it can do something every
4m55s, or it may not. I'm not sure what satisfies windows definition of
inactivity to kick in a screensaver.

Mike

"Mike K" wrote:

Oh Wise Ones,
Due to circumstances beyond my control I can no
longer view my excel constantly running macro for longer than 5 mins before
my screen saver kicks in. Is there an excel solution to simulate mouse
movement or keystroke events to satisfy windows screensaver so as to not
innitiate? If not, is there a non-excel solution? As I said, I cannot modify
the screensaver settings, all I can do is make it look like I'm doing
something within a 5 min span. Any help would be appriciated.

Thanks,
Mike


okaizawa

Keeping excel visible
 
Hi,

you can use the SystemParametersInfo api to enable or disable the screen
saver, and the mouse_event api to move the mouse pointer.
(but some security settings might prevent your code running)

for example,

mouse_event
http://msdn.microsoft.com/en-us/winu...ouse_event.asp

Public Const MOUSEEVENTF_MOVE = &H1
Declare Sub mouse_event Lib "user32" ( _
ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, _
ByVal cButtons As Long, ByVal dwExtraInfo As Long)


Sub Test_mouse_event()

'your code

mouse_event MOUSEEVENTF_MOVE, 0, 0, 0, 0

'your code

mouse_event MOUSEEVENTF_MOVE, 0, 0, 0, 0

'your code ...

End Sub



SystemParametersInfo
http://msdn.microsoft.com/library/en...metersinfo.asp

Private Const SPI_GETSCREENSAVEACTIVE = 16
Private Const SPI_SETSCREENSAVEACTIVE = 17
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2

Private Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" ( _
ByVal uAction As Long, ByVal uParam As Long, _
ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long


Function IsScreenSaverActive() As Boolean
Dim pvParam As Long
SystemParametersInfo SPI_GETSCREENSAVEACTIVE, 0, pvParam, 0
IsScreenSaverActive = (pvParam < 0)
End Function

Function EnableScreenSaver(Enable As Boolean) As Boolean
EnableScreenSaver = SystemParametersInfo( _
SPI_SETSCREENSAVEACTIVE, CInt(Enable), ByVal 0&, 0)
End Function


Sub Test_EnableScreenSaver()
Dim isactive As Boolean
isactive = IsScreenSaverActive()
If isactive Then EnableScreenSaver False

'your code

If isactive Then EnableScreenSaver True
End Sub

--
HTH,

okaizawa


Mike K wrote:
To clarify, everything is fine if I'm at the computer mousing or keyboarding.
I need something to do these things for me when I'm accross the room or away
from the computer for more than 5 mins. Similar to "keep alive" programs for
dialup connections. A task schedular may work if it can do something every
4m55s, or it may not. I'm not sure what satisfies windows definition of
inactivity to kick in a screensaver.

Mike

"Mike K" wrote:


Oh Wise Ones,
Due to circumstances beyond my control I can no
longer view my excel constantly running macro for longer than 5 mins before
my screen saver kicks in. Is there an excel solution to simulate mouse
movement or keystroke events to satisfy windows screensaver so as to not
innitiate? If not, is there a non-excel solution? As I said, I cannot modify
the screensaver settings, all I can do is make it look like I'm doing
something within a 5 min span. Any help would be appriciated.

Thanks,
Mike



All times are GMT +1. The time now is 10:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com