Watchdog timer issues
I am using XL 2003.
I have a need to run Internet Explorer for about 20k URLs.
This is beyond the capacity of IE on my system.
I use a 30 second watchdog timer to detect IE becoming unreasonably slow.
Relevant code is:
' Needs Tools/References/Microsoft Internet Controls
Public ie As SHDocVw.InternetExplorer
Private killtime As Date
Private Const killduration As String = "00:00:30"
....
Private Sub kill_ie()
Debug.Print now & " kill_ie() called"
killtime = 0
Set ie = Nothing
End Sub
Public Function Wait4IEretry(ByVal operation As String) As Boolean
....
On Error GoTo newie
....
killtime = now + TimeValue(killduration)
Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", Schedule:=True
Wait4IE operation
Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False
If False Then
newie:
If killtime < 0 Then
On Error Resume Next ' ontime may not be set
Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False
End If
Set ie = Nothing
Resume retry
Stop
retry:
' Stop
Wait4IEretry = False
Exit Function
End If
....
Wait4IEretry = True
Exit Function
.....
End Function
So Wait4IEretry starts a 3o second watchdog timer on Wait4IE completing
in 30 seconds.
If 30 seconds elapses, kill_ie is called and ie is made nothing, causing
Wait4IE to complete with an error and transfer control to label newie.
I find "On Error Resume Next" ineffective against errors in Application.OnTime.
I zero killtime in kill_ie so Application.OnTime is not called.
If I hit escape to allow me to save my XL file, Application.OnTime is called and errors.
Why is "On Error Resume Next" ineffective?
If 30 seconds does not elapse, the timer is cancelled without problem.
I can't work out how to make killduration a date.
In the immediate debug window, I see
?#00:00:30#
00:00:30
?timevalue("00:00:30")
00:00:30
In the debug code window,
Private Const killduration As Date = #00:00:30#
is transformed into
Private Const killduration As Date = #12:00:30 AM#
As an sside, many cells in my worksheet have a small triangle marking
their upper left corner. I remember that as meaning there is some
strangeness about the data in the marked cells. I just can't
work out how to Google it.
excel cell warning message is ineffective.
excel cell triangle corner suggests a formula error and that a trace
error button should appear - it does not - the cells contain values.
Unsetting Tools/Options/Error checking/Number stored as text
causes those triangles to vanish and I now know what the issue is.
How to I get "Number stored as text" to appear as a warning?
--
Walter Briscoe
|