M
Mats Samson
I found recently a great solution to timed messages at The Xcel Files site,
http://www.xcelfiles.com by Ivan F Moala (Thanks Ivan!). I’ve seen many asked
for it but no good solution has been provided. The example code was about
animated GIF’s but with only a slight modification I changed it to use
whatever objects I like in my Forms. The most obvious usage would be to
display a self-closing message in the form when a certain condition is met,
maybe a warning. Warning messages in the status bar is not very alerting,
they have to appear where the user has his focus! I’ve used labels and they
can stay invisible until they’re needed and you can even set their attributes
to alert the user even more.
Here is a blinking message that automatically disappears after some time:
UserForm_Initialize()
LabelRateWarn1.Visible = False
End Sub
Other TriggerSub ()
.......
If ARate <> BRate Then
Warning
End If
End Sub
Sub Warning()
Dim y As Single, x As Single, z As Single
Dim Start, Delay
For x = 1 To 10
For y = 1 To 5
Start = Timer
Delay = Start + 0.15
Do While Timer < Delay
LabelRateWarn1.Visible = True
DoEvents
Loop
Next y
For z = 1 To 5
Start = Timer
Delay = Start + 0.15
Do While Timer < Delay
LabelRateWarn1.Visible = False
DoEvents
Loop
Next z
Next x
LabelRateWarn1.Visible = False
End Sub
If you don’t want the blinking, remove the loop Z.
Now to my problem!
I’m very fond of reusing code and I have several situations in various
locations of my multipage form where I’d like to display a message to the
user.
How do I declare a LabelName as a variable and transfer the variable between
procedures?
From TriggerSub_1 I would put the variable Mess = LabelRateWarn1
and go to Warning (Mess)
From TriggerSub_2 I would put the variable Mess = LabelPriceWarn2
and go to the same Warning (Mess)
where I have the actions Mess.Visible = True/False.
It could be even more sophisticated if I could send x, y, and z variables
from the Trigger-subs as well. Then I could set speed and length of the
blinking message.
Furthermore I’d like to have a message displayed until a click event! Say
that a
message is displayed at a menu. If the menu is idle, it’ll continue to be
displayed until the user clicks a either a specified button or the eventually
the form itself (non-idle state).
Can anybody help me with these?
http://www.xcelfiles.com by Ivan F Moala (Thanks Ivan!). I’ve seen many asked
for it but no good solution has been provided. The example code was about
animated GIF’s but with only a slight modification I changed it to use
whatever objects I like in my Forms. The most obvious usage would be to
display a self-closing message in the form when a certain condition is met,
maybe a warning. Warning messages in the status bar is not very alerting,
they have to appear where the user has his focus! I’ve used labels and they
can stay invisible until they’re needed and you can even set their attributes
to alert the user even more.
Here is a blinking message that automatically disappears after some time:
UserForm_Initialize()
LabelRateWarn1.Visible = False
End Sub
Other TriggerSub ()
.......
If ARate <> BRate Then
Warning
End If
End Sub
Sub Warning()
Dim y As Single, x As Single, z As Single
Dim Start, Delay
For x = 1 To 10
For y = 1 To 5
Start = Timer
Delay = Start + 0.15
Do While Timer < Delay
LabelRateWarn1.Visible = True
DoEvents
Loop
Next y
For z = 1 To 5
Start = Timer
Delay = Start + 0.15
Do While Timer < Delay
LabelRateWarn1.Visible = False
DoEvents
Loop
Next z
Next x
LabelRateWarn1.Visible = False
End Sub
If you don’t want the blinking, remove the loop Z.
Now to my problem!
I’m very fond of reusing code and I have several situations in various
locations of my multipage form where I’d like to display a message to the
user.
How do I declare a LabelName as a variable and transfer the variable between
procedures?
From TriggerSub_1 I would put the variable Mess = LabelRateWarn1
and go to Warning (Mess)
From TriggerSub_2 I would put the variable Mess = LabelPriceWarn2
and go to the same Warning (Mess)
where I have the actions Mess.Visible = True/False.
It could be even more sophisticated if I could send x, y, and z variables
from the Trigger-subs as well. Then I could set speed and length of the
blinking message.
Furthermore I’d like to have a message displayed until a click event! Say
that a
message is displayed at a menu. If the menu is idle, it’ll continue to be
displayed until the user clicks a either a specified button or the eventually
the form itself (non-idle state).
Can anybody help me with these?