LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
ed ed is offline
external usenet poster
 
Posts: 59
Default Userform blinking label

I have a userform with two labels and one button. I
would like to alternate the label backcolors between red
and white. ie label1 backcolor is white, label2 red

pause

label1 backcolor is red, label2 white and so forth.

Code in standard modual: (Adapted from an old post)

Blink is called from buttons click event. Code works if I
step through but does not work if breaks are removed. I'm
stumped.

TIA for any assistance

Ed

Option Explicit

Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal lbbuffer As String, _
nsize As Long) As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As
Long)

Public Sub Blink()
Dim mytime As String
Dim i As Long

For i = 1 To 50

' set one color
UserForm1.Label1.BackColor = &HFFFFFF
UserForm1.Label2.BackColor = &HFF&
Call Sleep(60)

UserForm1.Label1.BackColor = &HFF&
UserForm1.Label2.BackColor = &HFFFFFF
Call Sleep(60)
Next i

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Label Steve[_9_] Excel Discussion (Misc queries) 7 October 29th 07 09:51 PM
Blinking Label Bob Phillips[_6_] Excel Programming 0 June 29th 04 06:14 PM
Blinking Label Nigel Excel Programming 0 June 29th 04 04:51 PM
UserForm label doesn't load? Ed[_18_] Excel Programming 4 June 21st 04 07:53 PM
UserForm Label & Format Problems Mark Driscol Excel Programming 5 April 14th 04 08:33 PM


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"