Is there a way to make a label flash???
I have a label that gives some instructions to the user, apparently, the bold and CAPS are ignored. Is there a way to make it stand out???
Thanks
Flashing Label
-
- Administrator
- Posts: 78608
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Flashing Label
I'm not a fan of flashing text or objects - it quickly becomes annoying, and it can be dangerous to people who are prone to seizures.
But if you really want to make a label flash, you can do it as follows:
- Open the form in design view.
- Set the TimerInterval property of the form to (for example) 1000. This is in milliseconds, so it stands for 1 second.
- Create an event procedure for the On Timer event of the form:
This will change the text color. If you also want to change the background color, set the Back Style property of the label to Normal instead of Transparent.
Example:
But if you really want to make a label flash, you can do it as follows:
- Open the form in design view.
- Set the TimerInterval property of the form to (for example) 1000. This is in milliseconds, so it stands for 1 second.
- Create an event procedure for the On Timer event of the form:
Code: Select all
Private Sub Form_Timer()
' Change the name of the label to match yours.
With Me.lblFlash
If .ForeColor = vbBlack Then
.ForeColor = vbRed
Else
.ForeColor = vbBlack
End If
End With
End Sub
Example:
Code: Select all
Private Sub Form_Timer()
With Me.lblFlash
If .ForeColor = vbBlack Then
.ForeColor = vbWhite
.BackColor = vbBlack
Else
.ForeColor = vbBlack
.BackColor = vbWhite
End If
End With
End Sub
Best wishes,
Hans
Hans
-
- Lounger
- Posts: 35
- Joined: 21 Apr 2010, 19:19
Re: Flashing Label
Thanks!!!
I will use it for awhile and then turn it off.
They are not following instructions and I have tried to create it so user friendly....UUGGHHH.
Is there a way to have it flash a few times and then stop??
I will use it for awhile and then turn it off.
They are not following instructions and I have tried to create it so user friendly....UUGGHHH.
Is there a way to have it flash a few times and then stop??
-
- Administrator
- Posts: 78608
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Flashing Label
You could use a counter:
Change the number 4 above to another even number (2, 6, 8, ...) if you'd like the label to flash more or less.
Code: Select all
Private Sub Form_Timer()
Static lngCount As Long
' Change the name of the label to match yours.
With Me.lblFlash
If .ForeColor = vbBlack Then
.ForeColor = vbRed
Else
.ForeColor = vbBlack
End If
End With
lngCount = lngCount + 1
If lngCount = 4 Then
' Turn off the timer event
Me.TimerInterval = 0
End If
End Sub
Best wishes,
Hans
Hans