ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OnTime...Please Help (https://www.excelbanter.com/excel-programming/299180-ontime-please-help.html)

Michael_I

OnTime...Please Help
 
Hello!

I am working with a cognitive psychology test, which will serve as a
independant variable. The test runs a userform which consists of
random number and a random data set (consisting of 5 numbers). I hav
all of the fuctionallity setup except for the delay between the rando
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 dat
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 show
up until the participate presses the appropriate selection

I have attached the document I am using...

Thanks,
Mik

Attachment filename: cog test.zip
Download attachment: http://www.excelforum.com/attachment.php?postid=55346
--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

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/




Michael_I[_2_]

OnTime...Please Help
 
Hello Bob!

I like the way you explained the solution! I have been through th
code that you have provided along with the code on Chip's site. I a
still running into a problem. I can get both textboxes that I a
working with to display the random number and also the dataset and the
clear the text box. The problem that I am running into is that the
display at the same time. I need textbox1 to be displayed, the
textbox2. This has to happen without the use of another button (i
must run when the userform initializes).

Any suggestions how to make a pause, delete textbox1 the show textbox
- while in the same module? I was thinking that I could just call th
ontime to create the pause, but it does not seem to be working.

Thanks,
Mik

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

OnTime...Please Help
 
Michael,

Try this version

Dim endTime As Double

Private Sub UserForm_Activate()

TextBox1.Text = "Some value"

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

End Sub

as before, you need a procedure (actually two) in a standard module that
reacts to the OnTime
method

Sub clearTextbox1()

With UserForm1
.TextBox1.Text = ""
.TextBox2.Text = "Another value"
End With

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

End Sub


Sub clearTextbox2()
UserForm1.TextBox2.Text = ""
End Sub

--

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 Bob!

I like the way you explained the solution! I have been through the
code that you have provided along with the code on Chip's site. I am
still running into a problem. I can get both textboxes that I am
working with to display the random number and also the dataset and then
clear the text box. The problem that I am running into is that they
display at the same time. I need textbox1 to be displayed, then
textbox2. This has to happen without the use of another button (it
must run when the userform initializes).

Any suggestions how to make a pause, delete textbox1 the show textbox2
- while in the same module? I was thinking that I could just call the
ontime to create the pause, but it does not seem to be working.

Thanks,
Mike


---
Message posted from http://www.ExcelForum.com/




Michael_I[_3_]

OnTime...Please Help
 
o.k....this is really starting to hurt my head.

It seems that everything should be working with the appropriate code
but it is not. The first value is showing, and staying...nothing else

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

OnTime...Please Help
 
Michael,

Why not send we the workbook, and I'll take a look at it?

--

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
...
o.k....this is really starting to hurt my head.

It seems that everything should be working with the appropriate code,
but it is not. The first value is showing, and staying...nothing else.


---
Message posted from http://www.ExcelForum.com/




Michael_I[_5_]

OnTime...Please Help
 
Thanks Bob!


It is attached on my first post in this thread.

Mik

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

OnTime...Please Help
 
Michael,

I will need your email address as I do not post attachments to the NG, and I
cannot see it through the ExcelForum layer.

--

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
...
Thanks Bob!


It is attached on my first post in this thread.

Mike


---
Message posted from http://www.ExcelForum.com/




Michael_I[_6_]

OnTime...Please Help
 


--
Message posted from
http://www.ExcelForum.com


Bob Phillips[_6_]

OnTime...Please Help
 
Thanks Michael, response in the mail.

--

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
...



---
Message posted from
http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com