ThreeWave Blinking Text In Excel

This page describes how to make blinking text in Excel.
ShortFadeBar

Introduction

Excel does not have any built in feature to make text blink, and many people, including me, consider this a blessing. Most developers frown strongly at the notion of blinking text, arguing (with merit) that it is highly distracting. However, enough people have asked about it that it is worthy of discussion. Personally, I would not like a workbook with blinking text, but I don't share the passion of others in their dislike of the idea.

To make text blink,you need to execute a procedure periodically to change the font color of the text. The OnTime method can be used to run the procedure. You can use the code shown in the section below.

SectionBreak

Complete VBA Code

Public RunWhen As Double

Sub StartBlink()
    With ThisWorkbook.Worksheets("Sheet1").Range("A1").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, "'" & ThisWorkbook.Name & "'!StartBlink", , True
End Sub 

Sub StopBlink()
    ThisWorkbook.Worksheets("Sheet1").Range("A1").Font.ColorIndex = _
        xlColorIndexAutomatic
    Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False
End Sub

Then, in the ThisWorkbook code module of the workbook, use code like:

Private Sub Workbook_Open()
    StartBlink
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    StopBlink
End Sub

SectionBreak

Summary

Two important points to keep in mind:

  • Since the OnTime schedules a procedure every second, you'll encounter sluggish editing.
  • Blinking text may not be allowed in applications for governmental bodies, since it may be in violation of Section 508 of the Rehabilitation Act Of 1973 (since blinking text can cause seizures in epileptic patients).

This page last updated: 12-July-2007

 

-->