1 2 3 4 5 6 7 8
| Dim oldchar
Dim oldlen
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 17 Or KeyCode = 18 Then WebBrowser1.Visible = False: oldchar = IIf(TextBox1.Value <> "", Right(TextBox1.Value, 1), ""): oldlen = Len(TextBox1.Value)
End Sub
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If oldlen <> Len(TextBox1.Value) Or oldchar <> Right(TextBox1.Value, 1) Then WebBrowser1.Visible = True: TextBox1.SelStart = Len(TextBox1.Value)
End Sub |
Partager