ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting KeyPress Event to work (https://www.excelbanter.com/excel-programming/316131-getting-keypress-event-work.html)

Pete

Getting KeyPress Event to work
 
I'm building a VBA program with Excel 2003 which will measure how quickly
respondents correctly answer random 4-choice questions. I've succeeded in
getting a millisecond timer Class object to work, as well as a UserForm that
posts the random questions. Now the hard part is establishinig continuity of
control over the key events, and actually using my timer to determine the
time interval from (1) to (2) below:

1) Start the millisecond timer the moment user clicks the command button
that brings up the UserForm with the question and 4 answer choices;
2) Stop the timer the moment when the user hits Alt 1, Alt 2, Alt 3 or Alt 4
to answer the question.

In other words, I made the time capable of timing the lag between clicking
one ok box and clicking another--as a test that it worked--now I have to get
it hooked up to the userform with the question's answers on the 4 checkboxes.

Does this call for a Keypress event that will direct control off of the Q&A
userform?


Thanks!
Pete M

Tom Ogilvy

Getting KeyPress Event to work
 
Try the click event since one would think the user can use a keyboard or
mouse to make the selection.

--
Regards,
Tom Ogilvy

"Pete" wrote in message
...
I'm building a VBA program with Excel 2003 which will measure how quickly
respondents correctly answer random 4-choice questions. I've succeeded in
getting a millisecond timer Class object to work, as well as a UserForm

that
posts the random questions. Now the hard part is establishinig continuity

of
control over the key events, and actually using my timer to determine the
time interval from (1) to (2) below:

1) Start the millisecond timer the moment user clicks the command button
that brings up the UserForm with the question and 4 answer choices;
2) Stop the timer the moment when the user hits Alt 1, Alt 2, Alt 3 or Alt

4
to answer the question.

In other words, I made the time capable of timing the lag between clicking
one ok box and clicking another--as a test that it worked--now I have to

get
it hooked up to the userform with the question's answers on the 4

checkboxes.

Does this call for a Keypress event that will direct control off of the

Q&A
userform?


Thanks!
Pete M




Pete

Getting KeyPress Event to work
 
Thanks--that worked!

Best,
Peter

"Tom Ogilvy" wrote:

Try the click event since one would think the user can use a keyboard or
mouse to make the selection.

--
Regards,
Tom Ogilvy

"Pete" wrote in message
...
I'm building a VBA program with Excel 2003 which will measure how quickly
respondents correctly answer random 4-choice questions. I've succeeded in
getting a millisecond timer Class object to work, as well as a UserForm

that
posts the random questions. Now the hard part is establishinig continuity

of
control over the key events, and actually using my timer to determine the
time interval from (1) to (2) below:

1) Start the millisecond timer the moment user clicks the command button
that brings up the UserForm with the question and 4 answer choices;
2) Stop the timer the moment when the user hits Alt 1, Alt 2, Alt 3 or Alt

4
to answer the question.

In other words, I made the time capable of timing the lag between clicking
one ok box and clicking another--as a test that it worked--now I have to

get
it hooked up to the userform with the question's answers on the 4

checkboxes.

Does this call for a Keypress event that will direct control off of the

Q&A
userform?


Thanks!
Pete M






All times are GMT +1. The time now is 11:10 AM.

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