Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Close Open Woorkbook and Quit Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Close Open Woorkbook and Quit Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Close Open Woorkbook and Quit Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Close Open Woorkbook and Quit Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Close Open Woorkbook and Quit Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Close Open Woorkbook and Quit Excel

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel very slow to open or close RobinAdams Excel Discussion (Misc queries) 1 August 17th 06 05:01 PM
Excel should allow all open worksheets to close at once Jolly Jolly Excel Discussion (Misc queries) 2 May 25th 06 02:51 PM
Excel closes all open apps when i close one ipctech Excel Discussion (Misc queries) 1 May 25th 05 12:04 AM
EXCEL.exe stays open after Quit method in an HTA myriams9 Excel Programming 5 December 4th 03 07:06 AM
Open program with Application.Quit? Milos Setek Excel Programming 1 August 22nd 03 01:03 AM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"