Eric,
You need to ONTIME method. Change MyMacro to the name of yopur code and it
will run at 4 0 clock
Private Sub Workbook_Open()
Application.OnTime TimeValue("16:00:00"), "MyMacro"
End Sub
Mike
"Eric" wrote:
> Does anyone have any suggestion on how to add condition within macro?
> I would like to add coding only run TurnOffPC only after 4 pm
> Does anyone have any suggestions?
> Thank everyone very much for any suggestions
> Eric
>
> Sub mycoding
> ...
> ...
>
> TurnOffPC;
> End Sub
>
>
> '*******************SHUT DOWN*********************
> Sub TurnOffXP()
> 'shutdown.exe will NOT work on Windows 95, 98, 98 SE and ME
> ActiveWorkbook.Save
> Application.DisplayAlerts = False
> Application.Quit
> '//shut down the computer
> Shell "shutdown -s -t 02", vbHide
> End Sub
>
> Sub TurnOffPC()
> Dim Action As Long
> ActiveWorkbook.Save
> Application.DisplayAlerts = False
> '//shut down the computer
> Action = ExitWindowsEx(EWX_SHUTDOWN, 0&)
> Application.Quit
> End Sub
> '***************************************************
>
|