PDA

View Full Version : Automate Saving and Closing Excel Workbook after 2 minsutes



uzi_mon85
01-27-2015, 01:43 PM
Hi Community,

I am trying to automate my excel workbook to save and close by itself after being opened for 2 minutes.

the openning part i am handling via windows task scheduler,

however the saving and closing part I am trying to do via VBA with no luck so far. Here is the code, if one of you experts can please look at it to help me out, it will be greatly appreciated.'

Thanks,




Public Sub Workbook_Open() Application.OnTime Now + TimeValue("00:02:00"), "ThisWorkbook.TimeOutSaveAndClose"
End Sub

Public Sub TimeOutSaveAndClose()
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.Quit

End Sub

Simon Lloyd
01-28-2015, 12:00 PM
You need to give EVERY url that you have crossposted this question at!