Function OuiNon(TXTB, KeyAscii)
If Not "ouin" Like "*" & Chr(KeyAscii) & "*" Then KeyAscii = 0: Exit Function
With TXTB
t = .Value
.SelStart = Len(t)
Select Case Len(.Value)
Case 0: If "no" Like "*" & Chr(KeyAscii) & "*" Then t = t & Chr(KeyAscii)
Case 1: expr = IIf(t = "n", "o", "u"): If expr = Chr(KeyAscii) Then t = t & Chr(KeyAscii)
Case 2: expr = IIf(t = "no", "n", "i"): If expr = Chr(KeyAscii) Then t = t & Chr(KeyAscii)
End Select
KeyAscii = 0
.Value = Mid(t, 1, 3)
End With
End Function
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
OuiNon TextBox1, KeyAscii
End Sub
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
OuiNon TextBox2, KeyAscii
End Sub