Shutting Down Computer at a certain time

greg0226

New Member
Joined
Feb 24, 2002
Messages
31
I have tried searching for this but is there a way to have my computer shut down without saving anything at a certain time using VBA code? Any help would be great.

Thanks,
Greg
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
By some strange coincidence, I have actually programmed such an application. What my app did was when Excel was opened, the user was prompted with a userform that asked the user to enter a time. the application then waited until that time using "Application.Wait" then called this function with the value "True" to shut down NT.

<pre>
Private Declare Function ExitWindowsEx Lib "user32.dll" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Public Sub Main()
frmTime.Show
End Sub

Public Sub ShutDownNT(Force As Boolean)
' Shut Down NT
Dim ret As Long
Dim Flags As Long

Flags = EWX_SHUTDOWN
If Force Then Flags = Flags + EWX_FORCE
ExitWindowsEx Flags, 0
End Sub</pre>

I hope this helps you. I can't possibly think what you'd want to use this for. I just know exactly why I wanted it. :wink:
 
Upvote 0
On 2002-04-15 13:06, Cosmos75 wrote:
Is there anything computer-wise that CAN'T be done with Excel???

Windows is VB Based so there isn't too much
Xl cannot do since Excel uses VBA.
 
Upvote 0
On 2002-04-15 12:41, Chris Davison wrote:
Mark... you wanted all power cut when the bailiffs came round, right ?

:wink:

Suffice to say, I'd love to say why I made it, but I fear that someday my boss will find out about my 'net use at work and stumble across these archives and I don't want to get myself into even more trouble.

Mind you, this is the same boss that calls me into his office to ask him how to open a *.zip file.

"Um, yeah, you just double-click on it since you've got WinZip installed."
 
Upvote 0
Thank you very much for the response. Would I need to change something if i am using XP? The reason I want it is kind of stupid. I usually leave my home computer on when i go to work but am usually sending files (big mp3 mixes) to some friends so I want to be able to just shut my computer down after those are done instead of leaving my computer on all day. Anyway, thank you. I will give it a try when i get home.

Greg
This message was edited by greg0226 on 2002-04-15 13:28
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top