Hi,
I have a workbook that I want to run 2 Ontime codes. I want the workbook to save every 5 minutes but I also want it to close at 10PM. These codes work independently but I can't figure out how to get them to work together in the ThisWorkbook tab. I would like to have them both be wookbook_open if possible
This is the code:
I have a workbook that I want to run 2 Ontime codes. I want the workbook to save every 5 minutes but I also want it to close at 10PM. These codes work independently but I can't figure out how to get them to work together in the ThisWorkbook tab. I would like to have them both be wookbook_open if possible
This is the code:
VBA Code:
Private Sub Workbook_Open()
On Error Resume Next
Application.OnTime VBA.TimeValue("22:00:00"), "SaveAndCloseWorkBook", , True
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Application.OnTime Now + TimeValue("00:05:30"), "Save1"
End Sub