N
naeem.mahmood
Hello
I found the following blinking text code via this forum.
------------------------------------------------
' First, you need to set up a procedure to cause the text to
alternate
between white and black.
' Put the following code in a regular code module:
Private RunWhen As Double
Sub StartBlink()
If Range("Blink").Font.ColorIndex = 2 Then
Range("Blink").Font.ColorIndex = xlColorIndexAutomatic
Else
Range("Blink").Font.ColorIndex = 2
End If
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub
Sub StopBlink()
Range("Blink").Font.ColorIndex = xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink", , False
End Sub
' In both these procedures, change the reference to A1 to the cell
that should blink.
' When the workbook is closed, you need to cancel OnTime event
triggers,
' so put the following code in the ThisWorkbook code module.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopBlink
End Sub
' You need to initiate this procedure when the workbook opens, so put
the following code
' in the ThisWorkbook code module:
Private Sub Workbook_Open()
StartBlink
End Sub
---------------------------------------------------------
Its working fine as long as no other excel file is not open. As soon
as I open anything else following error open.
"Run-time erroe '1004': Method 'Range' of object'_Global failed."
Could anyone please help as I want to use this code while other files
are open.
Thanks,
Naeem
I found the following blinking text code via this forum.
------------------------------------------------
' First, you need to set up a procedure to cause the text to
alternate
between white and black.
' Put the following code in a regular code module:
Private RunWhen As Double
Sub StartBlink()
If Range("Blink").Font.ColorIndex = 2 Then
Range("Blink").Font.ColorIndex = xlColorIndexAutomatic
Else
Range("Blink").Font.ColorIndex = 2
End If
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub
Sub StopBlink()
Range("Blink").Font.ColorIndex = xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink", , False
End Sub
' In both these procedures, change the reference to A1 to the cell
that should blink.
' When the workbook is closed, you need to cancel OnTime event
triggers,
' so put the following code in the ThisWorkbook code module.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopBlink
End Sub
' You need to initiate this procedure when the workbook opens, so put
the following code
' in the ThisWorkbook code module:
Private Sub Workbook_Open()
StartBlink
End Sub
---------------------------------------------------------
Its working fine as long as no other excel file is not open. As soon
as I open anything else following error open.
"Run-time erroe '1004': Method 'Range' of object'_Global failed."
Could anyone please help as I want to use this code while other files
are open.
Thanks,
Naeem