A
Antonio
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
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