I'm trying to have a file auto-Close (with a Save) at a set time ever
day IF it's open at that time.
To do this, I've put the following code in 'ThisWorkbook':
Private Sub Workbook_Open()
Application.OnTime TimeValue("17:15:00"), "TimeMacro"
End Sub
And I've put this in Module 1:
Sub TimeMacro()
Application.DisplayAlerts = False
ActiveWorkbook.Close
End Sub
That works fine in that if the file is open, the file is automaticall
saved and closed. However if the file is NOT open at the set tim
(17:15) and Excel is running, Excel tries to re-open the file (gives m
the Enable macro message) to run the macro, and I want to avoid this.
understand why the macro is doing what it's doing, but how can I ge
Excel to not run TimeMacro when the file is closed.
Many thanks,
Cliv
--
Clivey_U
-----------------------------------------------------------------------
Clivey_UK's Profile:
http://www.excelforum.com/member.php...fo&userid=3256
View this thread:
http://www.excelforum.com/showthread.php?threadid=53778