Hi all,
I need to shut down an excel network file after 20 minutes. I initially used simple code like application.quit or the close method but often when closing an empty shell was left behind which was untidy. I tried a few things to no avail and finally settled on the below which works in so far as no shell but now often closes other excel files that are open at the same time.
Can anyone suggest a cleaner more robust method please?

Dim DownTime As Date
Sub SetTimer()
    'set the time duration the file can remain unattended for before close event
    DownTime = Now + TimeValue("00:20:00")
    Application.OnTime EarliestTime:=DownTime, _
      Procedure:="ShutDown", Schedule:=True
End Sub
Sub StopTimer()
    On Error Resume Next
    Application.OnTime EarliestTime:=DownTime, _
      Procedure:="ShutDown", Schedule:=False
 End Sub
Sub ShutDown()
Application.DisplayAlerts = False
'runs the subroutine to save a copy of the file before closing
Call SaveCopy
'ensure an empty Excel shell does not remain on screen after closing
If Application.Workbooks.Count = 1 Then
    Application.Quit
Else
    ActiveWorkbook.Close
End If
End Sub