cs_kev44
Messages postés2Date d'inscriptionmardi 27 mai 2003StatutMembreDernière intervention28 mai 2003
-
27 mai 2003 à 15:46
UnExPeCtEdSpy
Messages postés139Date d'inscriptionmercredi 7 août 2002StatutMembreDernière intervention 3 juillet 2003
-
28 mai 2003 à 11:14
je suis sous vbexcel et lorsque je fini de tapper un texte dans un textbox je voudrai la valider en appuyant sur la touche ENTREE (actionner un bouton de commande).
UnExPeCtEdSpy
Messages postés139Date d'inscriptionmercredi 7 août 2002StatutMembreDernière intervention 3 juillet 2003 27 mai 2003 à 17:23
Bonjour,
tu peus tout simplement detecter l'appuie d'une touche dans ta textbox et lorque cette touche est la touche entrer lancer ton code de validation.
Exemple
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
if keyascii = 13 then
Call mafunctionvalidation
end if
end sub
cs_kev44
Messages postés2Date d'inscriptionmardi 27 mai 2003StatutMembreDernière intervention28 mai 2003 28 mai 2003 à 08:44
désolé mais ca ne fonctionne pas car lorsque je suis dans un textbox et que je tappe la touche entree , elle n'est pas reconnu car j'ai essayé les commandes suivantes :
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
if keyascii = 13 then
msgbox " la touche enrée fonctionne"
end if
end sub
lorsque je tappe la touche entrée rien ne se passe.
merci quand meme.
a+
UnExPeCtEdSpy
Messages postés139Date d'inscriptionmercredi 7 août 2002StatutMembreDernière intervention 3 juillet 2003 28 mai 2003 à 11:14
Effectivement tu es en vba, et bizarement le keypress de renvoie pas le code ENTER
essaie le keyup ou keydown et tu verras que ça fonctionne avec la touche ENTER
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyAscii = 13 Then
MsgBox "SiSi ça fonctionne"
End If
End Sub