Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Antonio
 
Posts: n/a
Default killing an OnTime schedule launched from a different workbook

client1 portfolio.xls workbook launches every minute the following to update
the max and min of a portfolio value that is updated with real prices. Note
that the time in an exact minute so that it is easy to know the exact time
next scheduled:

Application.OnTime TimeValue(Hour(Now) & ":" & Minute(Now)) +
TimeValue("00:01"), "max_min"

Within the same workbook I have

Public Sub kill_max_min()

Application.OnTime TimeValue(Hour(Now) & ":" & Minute(Now)) +
TimeValue("00:01"), "max_min", , False

End Sub

That kills the OnTime when needed, for example, Before_Close. Killing the
OnTime schedule is needed because otherwise the workbook opens up after
closing (Is there an easier way to avoid the automatic reopening?). It works
fine when within the same workbook.

However, a different project in a different workbook needs to close the
workbook above. Before closing, ( since the Before_Close module is not run
when closing programmatically), I need to kill the max_min scheduled. I am
using

Application.Run "'" & client(client_index) & " portfolio.xls" &
"'!kill_max_min"


It does run the kill_max_min but it gives error. Run time error 1004. Method
On Tie of object_ Application failed.

It looks like it has lost the addressing to max_min

How can it be solved? Am I complicating this unnecessarily?

Thanks,

Antonio

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default killing an OnTime schedule launched from a different workbook

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:

client1 portfolio.xls workbook launches every minute the following to update
the max and min of a portfolio value that is updated with real prices. Note
that the time in an exact minute so that it is easy to know the exact time
next scheduled:

Application.OnTime TimeValue(Hour(Now) & ":" & Minute(Now)) +
TimeValue("00:01"), "max_min"

Within the same workbook I have

Public Sub kill_max_min()

Application.OnTime TimeValue(Hour(Now) & ":" & Minute(Now)) +
TimeValue("00:01"), "max_min", , False

End Sub

That kills the OnTime when needed, for example, Before_Close. Killing the
OnTime schedule is needed because otherwise the workbook opens up after
closing (Is there an easier way to avoid the automatic reopening?). It works
fine when within the same workbook.

However, a different project in a different workbook needs to close the
workbook above. Before closing, ( since the Before_Close module is not run
when closing programmatically), I need to kill the max_min scheduled. I am
using

Application.Run "'" & client(client_index) & " portfolio.xls" &
"'!kill_max_min"

It does run the kill_max_min but it gives error. Run time error 1004. Method
On Tie of object_ Application failed.

It looks like it has lost the addressing to max_min

How can it be solved? Am I complicating this unnecessarily?

Thanks,

Antonio


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Antonio
 
Posts: n/a
Default killing an OnTime schedule launched from a different workbook

Hi Dave,

Yes, you are right. Ithe workbook_beforeclose event is fired when closing
from a different workbook.



It is just, that, as you can see from my other post. The ontime does not
seem to be cancelled when run from the beforeclose.



I am not disabling events.

"Dave Peterson" wrote:

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:

client1 portfolio.xls workbook launches every minute the following to update
the max and min of a portfolio value that is updated with real prices. Note
that the time in an exact minute so that it is easy to know the exact time
next scheduled:

Application.OnTime TimeValue(Hour(Now) & ":" & Minute(Now)) +
TimeValue("00:01"), "max_min"

Within the same workbook I have

Public Sub kill_max_min()

Application.OnTime TimeValue(Hour(Now) & ":" & Minute(Now)) +
TimeValue("00:01"), "max_min", , False

End Sub

That kills the OnTime when needed, for example, Before_Close. Killing the
OnTime schedule is needed because otherwise the workbook opens up after
closing (Is there an easier way to avoid the automatic reopening?). It works
fine when within the same workbook.

However, a different project in a different workbook needs to close the
workbook above. Before closing, ( since the Before_Close module is not run
when closing programmatically), I need to kill the max_min scheduled. I am
using

Application.Run "'" & client(client_index) & " portfolio.xls" &
"'!kill_max_min"

It does run the kill_max_min but it gives error. Run time error 1004. Method
On Tie of object_ Application failed.

It looks like it has lost the addressing to max_min

How can it be solved? Am I complicating this unnecessarily?

Thanks,

Antonio


--

Dave Peterson

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 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
How to refenence ranges on a closed workbook GjArt Excel Discussion (Misc queries) 4 November 29th 05 03:49 PM
#VALUE ! errorr for links to other workbook Janez Banez Excel Worksheet Functions 2 January 15th 05 10:58 PM
make hidden window or workbook visible without specify the name mango Excel Worksheet Functions 1 December 30th 04 03:05 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 04:46 PM.

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

About Us

"It's about Microsoft Excel"