View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Frank Situmorang[_2_] Frank Situmorang[_2_] is offline
external usenet poster
 
Posts: 65
Default VBA code does not work

I already copied that Phil, exactly like the VBA I mentioned. Maybe somthing
I missed.
Application.OnTime RunWhen, "'" & ThisWorkbook.Name

Waht is this: "'" , should it be filled in the middle?

--
H. Frank Situmorang


"Frank Situmorang" wrote:

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