View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default OnTime...Please Help

Michael,

Here is a simple example to set the textbox

Dim starttime As Double

Private Sub CommandButton1_Click()

TextBox1.Text = "Another value"

starttime = Now + TimeSerial(0, 0, 1)
Application.OnTime starttime, "clearTextbox", schedule:=True

End Sub

Private Sub UserForm_Activate()

TextBox1.Text = "Some value"

starttime = Now + TimeSerial(0, 0, 2)
Application.OnTime starttime, "clearTextbox", schedule:=True

End Sub

and you also need a procedure in a standard module that reacts to the OnTime
method

Sub clearTextbox()
UserForm1.TextBox1.Text = ""
End Sub


Also, take a look at www.cpearson.com/excel/ontime.htm for more details.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Michael_I " wrote in message
...
Hello!

I am working with a cognitive psychology test, which will serve as an
independant variable. The test runs a userform which consists of a
random number and a random data set (consisting of 5 numbers). I have
all of the fuctionallity setup except for the delay between the random
number and the data set.

I would like the userform to open, display the random number for (2)
seconds, then delete it from the text box. (1) second later the data
set is shown for (1) second, then delete it from the test box.

The tricky part is to start the timer at the time the dataset is shown
up until the participate presses the appropriate selection

I have attached the document I am using...

Thanks,
Mike

Attachment filename: cog test.zip
Download attachment:

http://www.excelforum.com/attachment.php?postid=553466
---
Message posted from http://www.ExcelForum.com/