automate save and close of excel

  • Thread starter Thread starter BINZA@
  • Start date Start date
B

BINZA@

I have a pc that shuts down each night automatically using AT command and
shutdown.exe.
My problem is this pc now has 2 x excel documents open at all times with
changes unsaved which are lost when this pc is forced to shutdown, what i am
after is a way of closing excel and saving changes at 17:55 each day of week
which is 10 minutes before pc shutdown.

Thanks for any ideas
 
I use this manually. Adapt within an ontime method
Application.OnTime TimeValue("17:00:00"), "my_Procedure"Sub CLOSE_ALL()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Application.Workbooks
If w.Name <> ThisWorkbook.Name Then
w.Save
w.Close
End If
Next w
ThisWorkbook.Save
Application.Quit
End Sub
 
go here
http://www.cpearson.com/excel/ontime.htm

sub closeat5
Application.OnTime TimeValue("17:00:00"), "CLOSE_ALL"
end sub

Sub CLOSE_ALL()'In case you want to do manually
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Application.Workbooks
If w.Name <> ThisWorkbook.Name Then
w.Save
w.Close
End If
Next w
ThisWorkbook.Save
Application.Quit
End Sub
 
Back
Top