Hibernate via VBA

G

Guest

Is there a way to hibernate a computer via Excel VBA?

I tried something like SendKeys "^{ESC}u", True
to get the shutdown box up but it doesn't work.

Any other ideas?

Thanks
 
A

aeroguy

use :

sendkeys ^{esc}
sendkeys u
sendkeys {down}{down} ' for my case to get to hibernate
sendkeys {enter}

this should work... working in my case
 
G

Guest

I tried the below but only got a "u" entered into an excel cell.

It seems that the below line is not working:

SendKeys "^{ESC}"

When I enter Ctl+Esc on the keyboard the start menu shows but for some
reason this doesn't work with sendkeys.

Is there another way to hibernate from excel VBA?
 
D

Dave Peterson

I'd use google to search one of the Visual Basic newsgroups for hybernate.
Maybe there's some API calls that you can use.

If you don't find anything, I'd post in one of the VB groups--but be sure to
tell them you want to run it in excel's VBA--include your version of windows and
your version of excel.

Good luck.
 
G

Guest

After a lot of hunting and trail and error I've managed to get it to work,
here it is:

Shell "C:\WINDOWS\System32\rundll32.exe powrprof.dll,SetSuspendState", vbHide

Pretty simple in the end
 

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