Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You could use a public variable in the workbook that's being closed.
I think you should take a look at how Chip Pearson does it: http://www.cpearson.com/excel/ontime.htm Notice that when he stops the process, it's using that global variable. Antonio wrote: Hello Dave, Before I continue, let me express my gratitude once again. Much appreciated. I managed to find your post and I replied to it. Yes, it fires, but the ontime is not killed. I have tried it again several times. I know now part of the explanation of my other problems. It turns out that if excel is running in the background sometimes the timer is not refreshed, then there is a mismatch between the timing as per the formula of exact minutes next and the last ontime scheduled. I have solved it by the crude way of storing in a cell the time of the next ontime everytime a refresh happens. I retrieve the content of that cell before the cancel Ontime and use it as the earliest time parameters. Is there a better way to store a global variant across projects? "Dave Peterson" wrote: use this http://groups.google.com/advanced_group_search to search for your posts. My question (repeated here): Why do you say that the workbook_beforeclose event doesn't fire when closing Workbook A from workbook B? It does for me. In fact, the only way I know to stop it is to disableevents before I close that workbook. If you're doing that, is there a reason? Antonio wrote: Sorry Dave, how do I find my posts? I don't find the way to do it and I may have missed the previous post. Thanks, Antonio "Dave Peterson" wrote: You have a follow up question at your previous post. Antonio wrote: The following kills the OnTime max_min when the workbook is closed normally Public Sub Workbook_BeforeClose(cancel As Boolean) kill_max_min End Sub Public Sub kill_max_min() Application.OnTime TimeValue(Hour(Now) & ":" & Minute(Now)) + TimeValue("00:01"), "max_min", , False End Sub However, when the workbook is closed from a different module with the Workbook. Close method, the BeforeClose above seems to run well and runs the kill_max_min but the OnTime is not killed, it comes back up as scheduled. Why is that? Thanks, Antonio -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|