'code à placer dans un module '---------------------------- Sub init_touches() ' il faut lancer ce code avant le reste pour initialiser ' la touche 0 Application.OnKey Key:="{enter}", procedure:="quizz1" Application.OnKey Key:="w", procedure:="quizz2" End Sub Sub quizz1() ' si la touche 0 est parametrée, à son appuie je viens ici1 MsgBox "joueur 1 à buzzer en premier" End Sub Sub quizz2() ' si la touche 0 est parametrée, à son appuie je viens ici1 MsgBox "joueur 2 à buzzer en premier" End Sub Sub zero_normal() 'code permettant de revenir à la normal Application.OnKey Key:="w" Application.OnKey Key:="{enter}" End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionprivate const cKeys as string = "k s d f g h j k" Sub init_touches() 'il faut lancer ce code avant le reste pour initialiser la touche 0 dim i%, k() as string k=split(ckeys," ") for i=1 to 8 Application.OnKey Key:=k(i-1), procedure:="quizz(" & i & ")" next i End Sub Sub quizz(byval iPlayer as integer) 'si la touche 0 est parametrée, à son appuie je viens ici MsgBox "joueur " & cstr(iplayer) & " a buzzé en premier" End Sub Sub zero_normal() 'code permettant de revenir à la normal dim i%, k() as string k=split(ckeys," ") for i=0 to 7 Application.OnKey Key:=k(i) next i End Sub