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. |
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. |
All times are GMT +1. The time now is 08:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com