Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Keep Awake Nudge

I'm running Excel 2003 under XP. Sometimes if I run an optimization
routine for an extended period VBA occasionally seems to get confused
and produce an error if the computer enters "sleep" mode. Not always,
but unpredictably. Then the computer hangs up waiting for me and I'm
not there to help it.

is there something I can do with VBA every ten minutes or so to give
XP a small keep awake nudge? When I think to do it, I manually turn
off the sleep mode before running a long optimization, but
unfortunately the human element (me) is not reliable enough.

Thanks.

Bill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Keep Awake Nudge

I've set my computers not to enter sleep mode at all if they are desktops,
or if they are laptops which are plugged in.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Bill Martin" wrote in message
...
I'm running Excel 2003 under XP. Sometimes if I run an optimization
routine for an extended period VBA occasionally seems to get confused
and produce an error if the computer enters "sleep" mode. Not always,
but unpredictably. Then the computer hangs up waiting for me and I'm
not there to help it.

is there something I can do with VBA every ten minutes or so to give
XP a small keep awake nudge? When I think to do it, I manually turn
off the sleep mode before running a long optimization, but
unfortunately the human element (me) is not reliable enough.

Thanks.

Bill



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Keep Awake Nudge

You could use two OnTime macros that call each other every 15 minutes.

Sub WakeUp()
Application.OnTime Now + TimeValue("00:15:00"), "Nudge"
End Sub

Sub Nudge()
Application.OnTime Now + TiveValue("00:15:00"), "WakeUp"
End Sub

"Bill Martin" wrote:

I'm running Excel 2003 under XP. Sometimes if I run an optimization
routine for an extended period VBA occasionally seems to get confused
and produce an error if the computer enters "sleep" mode. Not always,
but unpredictably. Then the computer hangs up waiting for me and I'm
not there to help it.

is there something I can do with VBA every ten minutes or so to give
XP a small keep awake nudge? When I think to do it, I manually turn
off the sleep mode before running a long optimization, but
unfortunately the human element (me) is not reliable enough.

Thanks.

Bill

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Keep Awake Nudge

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Keep Awake Nudge

On Sun, 2 Mar 2008 12:24:01 -0800, JLGWhiz
wrote:

You could use two OnTime macros that call each other every 15 minutes.

Sub WakeUp()
Application.OnTime Now + TimeValue("00:15:00"), "Nudge"
End Sub

Sub Nudge()
Application.OnTime Now + TiveValue("00:15:00"), "WakeUp"
End Sub

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

That's a very tidy, neat solution, but... Can you explain how this
keeps the OS from entering sleep mode? I'm already madly calling a
bunch of interrelated subroutines.

Is the "Application.OnTime" statement itself going to somehow keep the
OS from sleeping?

Thanks.

Bill


  #6   Report Post  
Posted to microsoft.public.excel.programming
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
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Keep Awake Nudge

On Sun, 2 Mar 2008 15:00:10 -0500, "Jon Peltier"
wrote:

I've set my computers not to enter sleep mode at all if they are desktops,
or if they are laptops which are plugged in.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com

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

The thing is that I like to use sleep mode 99% of the time when I'm
not at my machine John. The only time it seems to get me in trouble
is occasionally with Excel/VBA optimization routines.

This is in contrast to hibernation which seems to burn me in a number
of ways, so I don't use that except when a laptop lid gets closed.

Bill
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Keep Awake Nudge

You would need to program procedures named Nudge and WakeUp, using code like
Mark has provided. Application.OnTime doesn't do anything for you.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Bill Martin" wrote in message
...
On Sun, 2 Mar 2008 12:24:01 -0800, JLGWhiz
wrote:

You could use two OnTime macros that call each other every 15 minutes.

Sub WakeUp()
Application.OnTime Now + TimeValue("00:15:00"), "Nudge"
End Sub

Sub Nudge()
Application.OnTime Now + TiveValue("00:15:00"), "WakeUp"
End Sub

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

That's a very tidy, neat solution, but... Can you explain how this
keeps the OS from entering sleep mode? I'm already madly calling a
bunch of interrelated subroutines.

Is the "Application.OnTime" statement itself going to somehow keep the
OS from sleeping?

Thanks.

Bill



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003: How to nudge a chart element or shape on a chart? Ted M H Charts and Charting in Excel 5 June 30th 08 07:08 PM
nudge szelinko Charts and Charting in Excel 2 October 19th 07 05:47 PM
Nudge graphics down and right Susan Excel Programming 0 January 10th 07 03:44 PM
Nudge entry just a hair [email protected] Excel Discussion (Misc queries) 1 August 29th 06 01:02 AM
Nudge in XP RedChequer Excel Discussion (Misc queries) 2 September 19th 05 10:33 PM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"