G
gmferg1
The following code gives me the error "macro The_Sub cannot be found".
What is wrong? The code is enterend in the Workbook module and the
ontime does execute 10 seconds after I open the workbook. That is when
I get the error.
Public RunWhen As Double
Public RunWhat As String
Public myOffset As Double
Sub Workbook_Open()
myOffset = 0
StartTimer
End Sub
Sub Workbook_Close()
StopTimer
End Sub
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, 10)
RunWhat = "The_Sub"
Application.OnTime earliesttime:=RunWhen, procedure:=RunWhat,
schedule:=True
End Sub
Sub The_Sub()
Range("A4").Offset(0, myOffset) = myOffset
myOffset = myOffset + 1
StartTimer
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime ealiesttime:=RunWhen, procedure:=RunWhat,
schedule:=False
End Sub
What is wrong? The code is enterend in the Workbook module and the
ontime does execute 10 seconds after I open the workbook. That is when
I get the error.
Public RunWhen As Double
Public RunWhat As String
Public myOffset As Double
Sub Workbook_Open()
myOffset = 0
StartTimer
End Sub
Sub Workbook_Close()
StopTimer
End Sub
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, 10)
RunWhat = "The_Sub"
Application.OnTime earliesttime:=RunWhen, procedure:=RunWhat,
schedule:=True
End Sub
Sub The_Sub()
Range("A4").Offset(0, myOffset) = myOffset
myOffset = myOffset + 1
StartTimer
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime ealiesttime:=RunWhen, procedure:=RunWhat,
schedule:=False
End Sub