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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Let cells of excel blink

Status
Not open for further replies.

apestaart

Technical User
Feb 5, 2004
107
NL
I have put this thread at the wrong place (VB 5/6) instead of this forum. So I try again with the answers I have got.
I am looking for a way to let a range of an Excel worksheet background blinking.
The blinking should be started from the VB code while opening a messagebox and stopped by pressing OK on that messagebox.
Who knows a way?

Thanks in advance,
Apestaart


Find A Job or Post a Job Opening Click Here.
HughLerwill (Programmer) 12 Jan 07 14:35
I don't think you can set Excel cells to blink, however you may be able to do that by changing their background colours to alternate between two values using a Timer contol on a Form within your vb app.

regards Hugh,

Golom (Programmer) 12 Jan 07 15:04
The other fly in the ointment is that a MsgBox is a modal dialog which means that other processing (including timers for example) is suspended while the message box is displayed. You might need to use the MessageBox API so that you can allow other processing to continue.

apestaart (TechnicalUser) 15 Jan 07 12:26
I have tried some code I found in the threads you mentioned.
It is patialy working, but there are still some problems.

Underneith is my code. I have the following questions.
I can't stop the code Flash1 from running. I try to stop it with commandbutton Stopit.
Also it it not possible to give a given range an other style
(Error message).
Who can help me ?


Code:
Module1
Public NextTime As Date
Public Stoppen As Integer

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

  End With
 
  Application.OnTime NextTime, "Flash1"
End Sub

Sub StopNu()
  Application.OnTime NextTime, "Flash1", schedule:=False
  ActiveWorkbook.Styles("Flash").Font.ColorIndex = xlAutomatic
  MsgBox "stop nu"
End Sub

Private Sub CommandButton1_Click()
Dim strRange As String
    If CommandButton1.Caption = "OK" Then
        'Check caption, then change it.
        CommandButton1.Caption = "Clicked"
       
    Else
        CommandButton1.Caption = "OK"
       
    End If
    
  '   Worksheets("Sheet1").Range("a20").Style.Name = "Flash"    'Does not work!!
    
  Call Flash1 'starts the flash1 routine
  
   MsgBox "einde routine"
   
End Sub

Sub StopIt()
 Call StopNu  'Started with command button, but does not work Key press in not seen by the system
 MsgBox "Stop nu!"
End Sub

johnwm (Programmer) 16 Jan 07 2:42
That looks like VBA rather than VB. You will do better in forum707 as this forum is specifically for VB5/6

 
what is the business case for this ?

In any case, a search in google for "excel blink" provides numerous examples of code

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
One thing you might want to consider, if this is a commercial application.

If you are in the UK, then you should be aware of the Disability Discrimination Act (DDA). Certain types of visual cues which may discriminate against those with a visual impairment are illegal. Blinking cells may come into that category (especially for those with photo-sensitive epilepsy...)

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
I would try to make things as simple as possible. If you need only to attract user to specified range, design your own userform for handling message and use 'marching ants' effect. In pure excel vba, userform's module:
Code:
Private Sub UserForm_Initialize()
ActiveCell.Copy ' or any other range
End Sub

Private Sub UserForm_Terminate()
Application.CutCopyMode = False
End Sub

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top