#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Restart

Hi
Thanx evry1 who helped me to get thru my practs, its much appreciated.

I'm now faced with a scenario where i have a month end macro, but i need
this macro to run when i leave the office at the end of the month. can a
macro be written to shut the pc down so that its not on for the wknd or
overnite.

please advice or if possible steer me in the direction with a syntax help!!!!!

thanx in advance

regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Restart

Hi

Have a look at this previous post it has a solution posted by
keepitcool.

hope it helps you out

S


Could someone point me at some VBA to shut down a local PC
after a certain time. I'm okay with the Application.OnTime
method. And I've found the C code for the "ExitWindowsEx"
function but I'm afraid it's beyond me to convert to VBA.

All help welcome - Thanks - Phil


Reply Rate this post:

2 From: keepitcool - view profile
Date: Fri 17 Oct 2003 08:11
Email: keepitcool
Groups: microsoft.public.excel.programming
Not yet ratedRating:
show options
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse | Find messages by this author


Phil, the VBA for the C code you found.. :)


'In general section
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Private Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long


Private Sub ShutDown()
Dim ret&
If MsgBox("Press Cancel to PREVENT Shutdown!", _
vbOKCancel + vbCritical + vbApplicationModal) = vbCancel Then End
'reboot the computer
'ret = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
'shutdown
ret = ExitWindowsEx(EWX_FORCE Or EWX_SHUTDOWN, 0)
End Sub


keepITcool

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
How to restart a code upon vbno FARAZ QURESHI Excel Discussion (Misc queries) 2 March 2nd 09 07:51 AM
HOW TO RESTART COUNT FORMULA tgcali Excel Discussion (Misc queries) 3 April 21st 08 11:26 PM
HOW TO RESTART COUNT FORMULA akphidelt Excel Discussion (Misc queries) 0 April 21st 08 10:56 PM
Won't restart after close Markk Primack[_2_] Excel Discussion (Misc queries) 3 September 2nd 07 02:27 PM
'Do Until...' Restart Jack Excel Programming 3 June 22nd 06 09:03 AM


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

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

About Us

"It's about Microsoft Excel"