Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blinking Shape ? 1

Status
Not open for further replies.

Recce

Programmer
Aug 28, 2002
425
0
0
ZA
Good day everyone,

I got some code in the forum on how to make 'n cell blink and it works good however, I am trying to use the same code to make a shape blink. I was hoping someone could help me to just structure the code correctly. Below is the code for the blinking cell in Excel and below that is my very wrong and unstructured code. I was hoping someone could maybe look at this please.

Blinking Excel Cell code:

Dim NextTime As Date

Sub Flash()
NextTime = Now + TimeValue("00:00:01")
With ActiveWorkbook.Styles("Flash").Font
If .ColorIndex = 2 Then .ColorIndex = 3 Else .ColorIndex = 2
End With
Application.OnTime NextTime, "Flash"
End Sub

Sub StopIt()
Application.OnTime NextTime, "Flash", schedule:=False
ActiveWorkbook.Styles("Flash").Font.ColorIndex = xlAutomatic
End Sub


The code for the Shape to blink:

Dim NextTime As Date

Sub Flash()
NextTime = Now + TimeValue("00:00:01")

With ActiveSheet.Shapes("Flowchart: Decision 1").Select
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1
End With
If .SchemeColor = 2 Then .SchemeColor = 3 Else .SchemeColor = 2
End With
Application.OnTime NextTime, "Flash"
End Sub

Sub StopIt()
Application.OnTime NextTime, "Flash", schedule:=False
ActiveWorkbook.Styles("Flash").Font.ColorIndex = xlAutomatic
End Sub




Regards

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
No need to select shape:
Code:
With ActiveSheet.Shapes("Flowchart: Decision 1").Fill.ForeColor
   If .SchemeColor=2 Then .SchemeColor=3 Else .SchemeColor=2
End With
Reset the colour in StopIt procedure. Add an error handler for the case when user select other sheet.


combo
 
Excellent !

Thanks for this combo...

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top