Thread: error 1004
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default error 1004


You are right. The Ontime function isn't doing anything. If the macro(s)
still work then simply eliminate the ONTime statement. I suspect the real
code is in the routine RUNTIMER. It looks like the person who wrote the code
didn't realize the OnError statment masked a problem. Not sure what
changges you made the caused the error to show up.

You have reached the frustration stage of programming in VBA. Everybody
goes through it at the beginning. The POOR documentation and bad examples
that microsoft provides gets everybody inot this state of mind.

"pls123" wrote:

hi joel , SORRY AGAIN !

my question is .. may i disable that row definitely ??

tx !!



"Joel" wrote:

What does NTIME equal?

Public Sub StartTimer()

Dim aWB As Workbook
Dim aWS As Worksheet
Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

On Error Resume Next
Application.OnTime _
EarliestTime:=nTime, _
Procedu="RunTimer", _
Schedule:=False

'On Error GoTo 0

aWS.Range("O8").Value = 0
aWS.Range("G10").Calculate

RunTimer
End Sub


"pls123" wrote:

Hi all again !!!
i got this error opening my page..

=============
run time error 1004
method 'ontime' of object '_application' failed
=============

on this line ...
Application.OnTime nTime, "RunTimer", , False


....if i dont set "error resume next"
...how can avoid it ??
This is all the macro.. tx for help !!






Option Explicit

Public nTime As Double

================================================== =

Public Sub StartTimer()

Dim aWB As Workbook
Dim aWS As Worksheet
Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

On Error Resume Next
Application.OnTime nTime, "RunTimer", , False '<<<<<<<<<<<<<<
'On Error GoTo 0

aWS.Range("O8").Value = 0
aWS.Range("G10").Calculate

RunTimer
End Sub