MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Timed Displaying


Posted by Cory on June 15, 2001 10:22 AM

Is there a way to display a label for a certain number of seconds before making its "visible" property false?
For example, I want a label's caption to display something for five seconds then display something else.


Posted by Sean on June 15, 2001 2:08 PM


===========
Try adding this code to your application.

Sub Timedelay()

ActiveSheet.Shapes("Text Box 1").Visible = True

Application.Wait (Now + TimeValue("0:00:10"))

ActiveSheet.Shapes("Text Box 1").Visible = False

End Sub


Sean

Posted by Cory on June 15, 2001 2:39 PM

Thanks Sean. Worked great. That one's been bugging me all day.

Posted by Sean on June 15, 2001 3:35 PM

This is what your after I think...

Sub ShwComs()

Range("A1").Select
Range("A1").Comment.Text Text:="Sean:" & Chr(10) & "Hello there"

ActiveCell.Comment.Visible = True
Range("A1").Select

Application.Wait (Now + TimeValue("0:00:10"))

ActiveCell.Comment.Visible = False

Range("A1").Comment.Text Text:="Sean:" & Chr(10) & "Is this what you want"

ActiveCell.Comment.Visible = True

Application.Wait (Now + TimeValue("0:00:10"))

ActiveCell.Comment.Visible = False

End Sub

======
Sean

Posted by S on June 15, 2001 3:54 PM

Posted by Sean on June 15, 2001 4:12 PM

Sub ShwComs()

Range("A1").Select
On Error Resume Next
Range("A1").AddComment
On Error GoTo 0
Range("A1").Comment.Text Text:="Sean:" & Chr(10) & "Hello there"

ActiveCell.Comment.Visible = True

Application.Wait (Now + TimeValue("0:00:02"))

ActiveCell.Comment.Visible = False

Application.Wait (Now + TimeValue("0:00:02"))

Range("A1").Comment.Text Text:="Sean:" & Chr(10) & "Is this what you want"

ActiveCell.Comment.Visible = True

Application.Wait (Now + TimeValue("0:00:02"))

ActiveCell.Comment.Visible = False

End Sub
======

Just noticed,

If you don't already have a comment in cell A1 you will get an error so I have now added in the add.comment line to the code, as well as the error trap for when you try and add a comment to a cell that already has one...

Sean.
======

=========