Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Run - time error '1004'

Hello,

I have a file with a code for blinking text.
At this moment I am entering some data in this file, so I click on macro in
the tool bar to stop the blink texts. The problem is that after I save the
file and come to close the file, a window appears with this error.

Run - time error '1004'
Method 'On Time' of object '_Application' failed.

Continue End Debug Help

Below is the code:


Public RunWhen As Double
Sub StartBlink1()
With ThisWorkbook.Worksheets("Open").Range("A1:A3,B1:B3 ,C1:C3").Font
If .ColorIndex = 5 Then ' Red Text
.ColorIndex = 49 ' White Text
Else
.ColorIndex = 5 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink1", , True
End Sub

Sub StopBlink1()

ThisWorkbook.Worksheets("Open").Range("A1:A3,B1:B3 ,C1:C3").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink1", , False
End Sub
Sub StartBlink2()
With ThisWorkbook.Worksheets("Serie A").Range("AP6,AX6").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink2", , True
End Sub

Sub StopBlink2()
ThisWorkbook.Worksheets("Serie A").Range("AP6,AX6").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink2", , False
End Sub


Sub StartBlink3()
With ThisWorkbook.Worksheets("Serie B").Range("AP6,AX6").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink3", , True
End Sub

Sub StopBlink3()
ThisWorkbook.Worksheets("Serie B").Range("AP6,AX6").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink3", , False
End Sub
Sub StartBlink4()
With ThisWorkbook.Worksheets("Serie C").Range("AP6,AX6,AP83,AX83").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink4", , True
End Sub

Sub StopBlink4()
ThisWorkbook.Worksheets("Serie
C").Range("AP6,AX6,AP83,AX83").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink4", , False
End Sub

Any help please,
Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Run - time error '1004'


A "1004" error is a very generic error that means "something went
wrong but we're not going to tell you what". When you get the error,
click on the Debug button in the message box. That will take you to
the offending line of code. Post that line of code.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Mon, 17 Aug 2009 06:45:01 -0700, MAX
wrote:

Hello,

I have a file with a code for blinking text.
At this moment I am entering some data in this file, so I click on macro in
the tool bar to stop the blink texts. The problem is that after I save the
file and come to close the file, a window appears with this error.

Run - time error '1004'
Method 'On Time' of object '_Application' failed.

Continue End Debug Help

Below is the code:


Public RunWhen As Double
Sub StartBlink1()
With ThisWorkbook.Worksheets("Open").Range("A1:A3,B1:B3 ,C1:C3").Font
If .ColorIndex = 5 Then ' Red Text
.ColorIndex = 49 ' White Text
Else
.ColorIndex = 5 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink1", , True
End Sub

Sub StopBlink1()

ThisWorkbook.Worksheets("Open").Range("A1:A3,B1:B 3,C1:C3").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink1", , False
End Sub
Sub StartBlink2()
With ThisWorkbook.Worksheets("Serie A").Range("AP6,AX6").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink2", , True
End Sub

Sub StopBlink2()
ThisWorkbook.Worksheets("Serie A").Range("AP6,AX6").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink2", , False
End Sub


Sub StartBlink3()
With ThisWorkbook.Worksheets("Serie B").Range("AP6,AX6").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink3", , True
End Sub

Sub StopBlink3()
ThisWorkbook.Worksheets("Serie B").Range("AP6,AX6").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink3", , False
End Sub
Sub StartBlink4()
With ThisWorkbook.Worksheets("Serie C").Range("AP6,AX6,AP83,AX83").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink4", , True
End Sub

Sub StopBlink4()
ThisWorkbook.Worksheets("Serie
C").Range("AP6,AX6,AP83,AX83").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink4", , False
End Sub

Any help please,
Thanks in advance.

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
run time error 1004 general odbc error excel 2003 vba Mentos Excel Programming 5 January 24th 11 02:56 PM
run-time error '1004' general odbc error Jeff Gross Excel Programming 2 March 26th 09 02:24 PM
Run Time Error 1004: Application or Object Defined Error BEEJAY Excel Programming 4 October 18th 06 04:19 PM
Run Time 1004 Error: Application or Object Difine Error BEEJAY Excel Programming 0 October 17th 06 10:45 PM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM


All times are GMT +1. The time now is 05:50 AM.

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"