Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to shut down open Excel workbooks at 11 PM to
start data update. These workbooks can be opened on different PC's and as such, I need to include in these workbooks code similar to On Timer event in Access. I have found following OnTime event, but now need a trigger to start it. If Format(Now(), "Medium Time") = Format ("23:00:00, "Medium Time") Then Application.OnTime Now + TimeValue ("00:0:05"), "Quit_Workbook" End If Perhaps there is a better way to do this as I am not too familiar with Excel programming. Any help or resource is greatly appreciated. Thanks. Lucy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You will want a function like this, to run on the ontime.
Sub QuitApp() Application.setwarnings false ThisWorkbook.Save ''Might need to change if you have multiple WBs open Application.quit End Sub Keith www.kjtfs.com --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, but what starts this sub at 11 PM?
Lucy -----Original Message----- You will want a function like this, to run on the ontime. Sub QuitApp() Application.setwarnings false ThisWorkbook.Save ''Might need to change if you have multiple WBs open Application.quit End Sub Keith www.kjtfs.com --- Message posted from http://www.ExcelForum.com/ . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
O I thought you had your ontime event running.
have a function in the workbookopen event that calls the ontime which will call the quit function. Keith www.kjtfs.com --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And the function "ontime" is what I am looking for! Once
I get it, then rest is relatively easy. Lucy -----Original Message----- O I thought you had your ontime event running. have a function in the workbookopen event that calls the ontime which will call the quit function. Keith www.kjtfs.com --- Message posted from http://www.ExcelForum.com/ . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have attached a file that closes 5 seconds after you open it. I think
this is what you are looking for. Change the code to 23:00:00 on the ontime event and it will close at 11. The ontime event is in the workbookopen event. To look at the code disable macros when you open the book so it doesn't close when you are looking at it. Hope this helps. Keith www.kjtfs.com Attachment filename: quitappwb.xls Download attachment: http://www.excelforum.com/attachment.php?postid=390287 --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel very slow to open or close | Excel Discussion (Misc queries) | |||
Excel should allow all open worksheets to close at once | Excel Discussion (Misc queries) | |||
Excel closes all open apps when i close one | Excel Discussion (Misc queries) | |||
EXCEL.exe stays open after Quit method in an HTA | Excel Programming | |||
Open program with Application.Quit? | Excel Programming |