M
MAX
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.
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.