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: