VBA code does not work
Works fine for me Frank. Did you put the workbook event procedures in
ThisWorkbook?
--
__________________________________
HTH
Bob
"Frank Situmorang" wrote in message
...
Hello,
I have inserted these VBA in the module, but the text in T2 does not
blink.
Did I miss something?
Public RunWhen As Double
Sub StartBlink()
With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).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("PO_Line_text").Range("T2" ).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
--
H. Frank Situmorang
|