Disa
Try this code. To test it, you will need to:
- Open a new workbook
- Add a UserForm named UserForm1
- Add a label named Label1 and insert some text
- Paste this code in the code module for the UserForm1
Private Sub UserForm_Initialize()
Call FlashfRM
End Sub
Private Sub UserForm_Terminate()
Call StopItfRM
End Sub
- Then add a module and paste this code
Dim NextTime As Date
Sub FlashfRM()
NextTime = Now + TimeValue("00:00:01")
With UserForm1
If .Label1.ForeColor = RGB(255, 0, 255) Then .Label1.ForeColor = RGB(255, 255, 0) Else .Label1.ForeColor = RGB(255, 0, 255)
End With
Application.OnTime NextTime, "Flashfrm"
End Sub
Sub StopItfRM()
Application.OnTime NextTime, "Flashfrm"
Application.OnTime NextTime, "Flashfrm", schedule:=False
End Sub
Once you've done that, run the UserForm - the initialise event will start the text
flashing - it will stop when you unload the form.
Any help?
Regards
Robb
Many thanks Robb - will give it a try.
ATTN ROBB: I've tried this but can't get the macro to stop! Any ideas?
Disa
It will not stop whilst the UserForm is running, but it should stop when the UserForm is unloaded.
If you want to stop it whils the UserForm is running, include a CommandButton or use the Click event (or some other) of the
UserForm to call the StopItfrm macro.
Any help?
Regards
Robb
ATTN ROBB: I've tried this but can't get the macro to stop! Any ideas?