View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bill Martin[_3_] Bill Martin[_3_] is offline
external usenet poster
 
Posts: 54
Default Keep Awake Nudge

On Sun, 2 Mar 2008 16:37:22 -0600, "Mark Ivey"
wrote:

Here is something you can try out...

I found this snippet @
http://www.experts-exchange.com/Prog..._23186029.html

Run the first one before your code starts and the second one after your code
completes. Just set the times you want them to be set back to in the
"turn_on" procedure in minutes. Omit the hibernate mode if you do not need
it.

Mark Ivey

Sub turn_off_standby_and_hybernation_modes()
''' Before starting your code
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "cmd /c powercfg /change ""Always On"" /standby-timeout-ac
0", 0, True
objShell.Run "cmd /c powercfg /change ""Always On""
/hibernate-timeout-ac 0", 0, True
objShell.Run "cmd /c powercfg /setactive ""Always On""", 0, True
Set objShell = Nothing
End Sub


Sub turn_on_standby_and_hybernation_modes()
''' After starting your code
''' Set the appropriate times in minutes below
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "cmd /c powercfg /change ""Always On"" /standby-timeout-ac
30", 0, True
objShell.Run "cmd /c powercfg /change ""Always On""
/hibernate-timeout-ac 60", 0, True
objShell.Run "cmd /c powercfg /setactive ""Always On""", 0, True
Set objShell = Nothing
End Sub


-----------------------------

Thanks Mark. I'll play with that as well as with the JLGWhiz approach
and see what I can get to work.

Bill