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

Excel given range blinking

Status
Not open for further replies.

apestaart

Technical User
Feb 5, 2004
107
NL
I am looking for a way to let a range of a 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
 
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,
 
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.
 
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
 
That looks like VBA rather than VB. You will do better in forum707 as this forum is specifically for VB5/6

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top