Hibernate using Excel macro

R

Rod Armour

Hi group,

I'm trying to tell a Win2k machine to boot from hibernate
automatically in the morning, run two programs unattended during the
day, one of them Excel XP, and then shut down in the afternoon. The
problem is that Win2k automatically goes back into hibernatation if it
has no tasks to perform, and unfortunately it does not accept my timed
Excel macros as cause for remaining on, so the computer goes back into
hibernation after just a few minutes. After attempting various
solutions, I have concluded that the answer is to employ a macro to
turn "hibernation" off in Win2k after the computer boots (resumes in
the morning), and then turn it back on before shut down in the
afternoon. I have been trying to access the "Hibernate" tab in Power
Option Properies (Control Panel) from an Excel macro, but that's the
problem. I can get to Power Option Properties using "SendKeys," but
once there, none of the "SendKey" commands act as expected and I can
find no combination that will highlight the Hibernate tab in order to
turn hibernatation off (and back on). For example, SendKeys "^{TAB}"
does NOT act like Ctrl+Tab on the keyboard. Does anyone know how to
send Ctrl+Tab using sendkeys, or call the Power Options Hibernate tab
from an Excel VB macro in order to turn hibernation on and off? If
not, might someone know how to turn hibernatation on and off with
Excel VB by another method?

Part of the code I've been using, but the SendKeys command "^(TAB)"
does not change tabs in the Power Options dialogue box.

Set WshShell = CreateObject("WScript.Shell")
'Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^{ESC}", True 'presses the Start button
Application.Wait Now + TimeValue("00:00:01")
WshShell.SendKeys "{DOWN}", True 'highlights a link to Power Options
Application.Wait Now + TimeValue("00:00:01")
WshShell.SendKeys "{ENTER}", True 'opens Power Options
Application.Wait Now + TimeValue("00:00:02")
WshShell.SendKeys "^{TAB}", True 'problem is here, this does NOT
switch tabs

Thanks for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top