Hi all and Aaron,
I need to no why in the below example why I have to press any key before the 
routine will toggle back to true, and if there's anyway I can prevent this as I 
just want the routine to toggle with out this behavour.  I have tried to return 
firstPress as True back to the calling point but it doesn't   work until I 
press any other key on the keyboard.  I have removed the line of code that 
attempt to return firstPress as True because it didn't make any difference.  If 
this is not the correct way of doing this, can somebody tell me what is.
' Detect if a key has been pressed twice in succession
Set myKey = Keyboard.RegisterHotKey("Control-R", "SpeakHelloWorld", , , True)
Function SpeakHelloWorld(firstPress)
Speak firstPress
       If firstPress Then
Speak "this is the first time you pressed"
Else
                 Speak "Key pressed twice"
       End If
End Function


Warm regards.
Martin Webster.



      

Reply via email to